pub struct EnvelopeRecipient(/* private fields */);Expand description
Envelope recipient path.
Implementations§
Source§impl EnvelopeRecipient
impl EnvelopeRecipient
Sourcepub fn new(
value: impl AsRef<str>,
) -> Result<EnvelopeRecipient, AddressValidationError>
pub fn new( value: impl AsRef<str>, ) -> Result<EnvelopeRecipient, AddressValidationError>
Creates an envelope recipient from address text.
Examples found in repository?
examples/email_facade_basic_usage.rs (line 9)
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 fn from_email_address(address: EmailAddress) -> EnvelopeRecipient
pub fn from_email_address(address: EmailAddress) -> EnvelopeRecipient
Creates an envelope recipient from a validated address.
Sourcepub const fn path(&self) -> &RcptToPath
pub const fn path(&self) -> &RcptToPath
Returns the RCPT TO path.
Trait Implementations§
Source§impl Clone for EnvelopeRecipient
impl Clone for EnvelopeRecipient
Source§fn clone(&self) -> EnvelopeRecipient
fn clone(&self) -> EnvelopeRecipient
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 EnvelopeRecipient
impl Debug for EnvelopeRecipient
Source§impl Display for EnvelopeRecipient
impl Display for EnvelopeRecipient
Source§impl Hash for EnvelopeRecipient
impl Hash for EnvelopeRecipient
Source§impl Ord for EnvelopeRecipient
impl Ord for EnvelopeRecipient
Source§fn cmp(&self, other: &EnvelopeRecipient) -> Ordering
fn cmp(&self, other: &EnvelopeRecipient) -> 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 EnvelopeRecipient
impl PartialEq for EnvelopeRecipient
Source§fn eq(&self, other: &EnvelopeRecipient) -> bool
fn eq(&self, other: &EnvelopeRecipient) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for EnvelopeRecipient
impl PartialOrd for EnvelopeRecipient
impl Eq for EnvelopeRecipient
impl StructuralPartialEq for EnvelopeRecipient
Auto Trait Implementations§
impl Freeze for EnvelopeRecipient
impl RefUnwindSafe for EnvelopeRecipient
impl Send for EnvelopeRecipient
impl Sync for EnvelopeRecipient
impl Unpin for EnvelopeRecipient
impl UnsafeUnpin for EnvelopeRecipient
impl UnwindSafe for EnvelopeRecipient
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