pub struct SmtpReplyCode(/* private fields */);Expand description
SMTP reply code.
Implementations§
Source§impl SmtpReplyCode
impl SmtpReplyCode
Sourcepub const fn new(value: u16) -> Result<SmtpReplyCode, SmtpError>
pub const fn new(value: u16) -> Result<SmtpReplyCode, SmtpError>
Creates a reply code in the inclusive range 100..=599.
Examples found in repository?
examples/email_facade_basic_usage.rs (line 14)
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}Trait Implementations§
Source§impl Clone for SmtpReplyCode
impl Clone for SmtpReplyCode
Source§fn clone(&self) -> SmtpReplyCode
fn clone(&self) -> SmtpReplyCode
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 SmtpReplyCode
impl Debug for SmtpReplyCode
Source§impl Display for SmtpReplyCode
impl Display for SmtpReplyCode
Source§impl Hash for SmtpReplyCode
impl Hash for SmtpReplyCode
Source§impl Ord for SmtpReplyCode
impl Ord for SmtpReplyCode
Source§fn cmp(&self, other: &SmtpReplyCode) -> Ordering
fn cmp(&self, other: &SmtpReplyCode) -> 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 SmtpReplyCode
impl PartialEq for SmtpReplyCode
Source§fn eq(&self, other: &SmtpReplyCode) -> bool
fn eq(&self, other: &SmtpReplyCode) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for SmtpReplyCode
impl PartialOrd for SmtpReplyCode
impl Copy for SmtpReplyCode
impl Eq for SmtpReplyCode
impl StructuralPartialEq for SmtpReplyCode
Auto Trait Implementations§
impl Freeze for SmtpReplyCode
impl RefUnwindSafe for SmtpReplyCode
impl Send for SmtpReplyCode
impl Sync for SmtpReplyCode
impl Unpin for SmtpReplyCode
impl UnsafeUnpin for SmtpReplyCode
impl UnwindSafe for SmtpReplyCode
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