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: Address
The 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::{message::Mailbox, Address};
let address = Address::new("example", "email.com")?;
let mailbox = Mailbox::new(None, address);
Trait Implementations§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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