pub struct EnvelopeSender(/* private fields */);Expand description
Envelope sender path.
Implementations§
Source§impl EnvelopeSender
impl EnvelopeSender
Sourcepub fn new(
value: impl AsRef<str>,
) -> Result<EnvelopeSender, AddressValidationError>
pub fn new( value: impl AsRef<str>, ) -> Result<EnvelopeSender, AddressValidationError>
Creates an envelope sender from address text.
Examples found in repository?
examples/email_facade_basic_usage.rs (line 8)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mailbox = address::Mailbox::new(Some("Jane Doe"), "jane@example.com")?;
5 let message_id: id::MessageId = "welcome@example.com".parse()?;
6 let message = message::EmailMessage::plain_text("Welcome", "A short note.")
7 .with_header("From", mailbox.to_string())?;
8 let envelope = envelope::Envelope::new(envelope::EnvelopeSender::new("bounce@example.com")?)
9 .with_recipient(envelope::EnvelopeRecipient::new("jane@example.com")?);
10 let mailto_uri = mailto::MailtoBuilder::new()
11 .to("jane@example.com")?
12 .subject("Welcome")
13 .build();
14 let reply = smtp::SmtpReply::new(smtp::SmtpReplyCode::new(250)?, "OK")?;
15 let spf = auth::spf::SpfRecord::new().with_term(auth::spf::SpfTerm::new(
16 auth::spf::SpfQualifier::Fail,
17 auth::spf::SpfMechanism::All,
18 ));
19
20 assert_eq!(message.subject(), Some("Welcome"));
21 assert_eq!(message_id.to_string(), "<welcome@example.com>");
22 assert_eq!(envelope.recipients().len(), 1);
23 assert_eq!(
24 mailto_uri.to_string(),
25 "mailto:jane@example.com?subject=Welcome"
26 );
27 assert_eq!(reply.to_string(), "250 OK");
28 assert_eq!(spf.to_string(), "v=spf1 -all");
29
30 Ok(())
31}Sourcepub const fn null() -> EnvelopeSender
pub const fn null() -> EnvelopeSender
Creates a null envelope sender.
Sourcepub const fn path(&self) -> &MailFromPath
pub const fn path(&self) -> &MailFromPath
Returns the MAIL FROM path.
Trait Implementations§
Source§impl Clone for EnvelopeSender
impl Clone for EnvelopeSender
Source§fn clone(&self) -> EnvelopeSender
fn clone(&self) -> EnvelopeSender
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnvelopeSender
impl Debug for EnvelopeSender
Source§impl Display for EnvelopeSender
impl Display for EnvelopeSender
Source§impl Hash for EnvelopeSender
impl Hash for EnvelopeSender
Source§impl Ord for EnvelopeSender
impl Ord for EnvelopeSender
Source§fn cmp(&self, other: &EnvelopeSender) -> Ordering
fn cmp(&self, other: &EnvelopeSender) -> Ordering
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
Source§impl PartialEq for EnvelopeSender
impl PartialEq for EnvelopeSender
Source§fn eq(&self, other: &EnvelopeSender) -> bool
fn eq(&self, other: &EnvelopeSender) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for EnvelopeSender
impl PartialOrd for EnvelopeSender
impl Eq for EnvelopeSender
impl StructuralPartialEq for EnvelopeSender
Auto Trait Implementations§
impl Freeze for EnvelopeSender
impl RefUnwindSafe for EnvelopeSender
impl Send for EnvelopeSender
impl Sync for EnvelopeSender
impl Unpin for EnvelopeSender
impl UnsafeUnpin for EnvelopeSender
impl UnwindSafe for EnvelopeSender
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