pub struct Envelope { /* private fields */ }
Expand description
Simple email envelope representation
We only accept mailboxes, and do not support source routes (as per RFC).
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn to(&self) -> &[Address]
pub fn to(&self) -> &[Address]
Gets the destination addresses of the envelope.
§Examples
let sender = "from@email.com".parse::<Address>()?;
let recipients = vec!["to@email.com".parse::<Address>()?];
let envelope = Envelope::new(Some(sender), recipients.clone())?;
assert_eq!(envelope.to(), recipients.as_slice());
Sourcepub fn from(&self) -> Option<&Address>
pub fn from(&self) -> Option<&Address>
Gets the sender of the envelope.
§Examples
let sender = "from@email.com".parse::<Address>()?;
let recipients = vec!["to@email.com".parse::<Address>()?];
let envelope = Envelope::new(Some(sender), recipients.clone())?;
assert!(envelope.from().is_some());
let senderless = Envelope::new(None, recipients.clone())?;
assert!(senderless.from().is_none());
Trait Implementations§
impl Eq for Envelope
impl StructuralPartialEq for Envelope
Auto Trait Implementations§
impl Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
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