pub struct Mailbox {
pub name: Option<String>,
pub email: Address,
}
Available on crate feature
builder
only.Expand description
Represents an email address with an optional name for the sender/recipient.
This type contains email address and the sender/recipient name (Some Name <user@domain.tld> or withoutname@domain.tld).
NOTE: Enable feature “serde” to be able to serialize/deserialize it using serde.
§Examples
You can create a Mailbox
from a string and an Address
:
let address = Address::new("example", "email.com")?;
let mailbox = Mailbox::new(None, address);
You can also create one from a string literal:
let mailbox: Mailbox = "John Smith <example@email.com>".parse()?;
Fields§
§name: Option<String>
The name associated with the address.
email: Address
The email address itself.
Implementations§
source§impl Mailbox
impl Mailbox
sourcepub fn new(name: Option<String>, email: Address) -> Self
pub fn new(name: Option<String>, email: Address) -> Self
Creates a new Mailbox
using an email address and the name of the recipient if there is one.
§Examples
use lettre::{message::Mailbox, Address};
let address = Address::new("example", "email.com")?;
let mailbox = Mailbox::new(None, address);
Trait Implementations§
source§impl<'de> Deserialize<'de> for Mailbox
impl<'de> Deserialize<'de> for Mailbox
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Extend<Mailbox> for Mailboxes
impl Extend<Mailbox> for Mailboxes
source§fn extend<T: IntoIterator<Item = Mailbox>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Mailbox>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl FromIterator<Mailbox> for Mailboxes
impl FromIterator<Mailbox> for Mailboxes
source§impl Ord for Mailbox
impl Ord for Mailbox
source§impl PartialEq for Mailbox
impl PartialEq for Mailbox
source§impl PartialOrd for Mailbox
impl PartialOrd for Mailbox
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Mailbox
impl StructuralPartialEq for Mailbox
Auto Trait Implementations§
impl Freeze for Mailbox
impl RefUnwindSafe for Mailbox
impl Send for Mailbox
impl Sync for Mailbox
impl Unpin for Mailbox
impl UnwindSafe for Mailbox
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more