pub struct Mailbox {
    pub name: Option<String>,
    pub email: Address,
}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: AddressThe 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 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 PartialOrd for Mailbox
 
impl PartialOrd for Mailbox
impl 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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more