msg_auth_status/
auth.rs

1//! Method auth Result
2
3/// Parsed auth (per RFC)
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct SmtpAuthResult<'hdr> {
6    /// Result
7    pub code: SmtpAuthResultCode,
8    /// smtp.auth
9    pub smtp_auth: Option<&'hdr str>,
10    /// smtp.mailfrom
11    pub smtp_mailfrom: Option<&'hdr str>,
12    /// Unparsed raw
13    pub raw: Option<&'hdr str>,
14}
15
16impl<'hdr> SmtpAuthResult<'hdr> {
17    pub(crate) fn set_smtp(&mut self, prop: &ptypes::AuthSmtp<'hdr>) -> bool {
18        match prop {
19            ptypes::AuthSmtp::MailFrom(val) => self.smtp_mailfrom = Some(val),
20            ptypes::AuthSmtp::Auth(val) => self.smtp_auth = Some(val),
21        }
22        true
23    }
24}
25
26/// SMTP AUTH Result Codes - s.2.7.4
27/// This SMTP Authentication (not DKIM)
28#[derive(Clone, Debug, Default, PartialEq)]
29pub enum SmtpAuthResultCode {
30    /// Result not seen
31    #[default]
32    Unknown,
33    /// SMTP authentication was not attempted.
34    NoneSmtp,
35    /// The SMTP client authenticated to the server
36    Pass,
37    /// The SMTP client attempted to authenticate but was not successful
38    Fail,
39    /// The SMTP client attempted to authenticate but was not able to complete
40    /// the attempt due to some error that is likely transient in nature
41    TempError,
42    /// The SMTP client attempted to authenticate but was not able to complete
43    /// the attempt due to some error that is likely not transient in nature
44    PermError,
45}
46
47pub mod ptypes;
48pub use ptypes::AuthProperty;