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) -> Mailbox
pub fn new(name: Option<String>, email: Address) -> Mailbox
Creates a new Mailbox using an email address and the name of the recipient if there is one.
§Examples
use lettre::{Address, message::Mailbox};
let address = Address::new("example", "email.com")?;
let mailbox = Mailbox::new(None, address);Trait Implementations§
impl Eq for Mailbox
Source§impl Ord for Mailbox
impl Ord for Mailbox
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Mailbox
impl PartialOrd for Mailbox
impl StructuralPartialEq for Mailbox
Auto Trait Implementations§
impl Forget for Mailbox
impl Freeze for Mailbox
impl RefUnwindSafe for Mailbox
impl Send for Mailbox
impl Sync for Mailbox
impl Unpin for Mailbox
impl UnsafeUnpin 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