samotop_core/smtp/command/
mail.rs

1use crate::smtp::SmtpPath;
2
3/// Starts new mail transaction
4#[derive(Eq, PartialEq, Debug, Clone)]
5pub enum SmtpMail {
6    Mail(SmtpPath, Vec<String>),
7    Send(SmtpPath, Vec<String>),
8    Saml(SmtpPath, Vec<String>),
9    Soml(SmtpPath, Vec<String>),
10}
11
12impl SmtpMail {
13    pub fn verb(&self) -> &str {
14        match self {
15            SmtpMail::Mail(_, _) => "MAIL",
16            SmtpMail::Send(_, _) => "SEND",
17            SmtpMail::Saml(_, _) => "SAML",
18            SmtpMail::Soml(_, _) => "SOML",
19        }
20    }
21    pub fn sender(&self) -> &SmtpPath {
22        match self {
23            SmtpMail::Mail(p, _) => p,
24            SmtpMail::Send(p, _) => p,
25            SmtpMail::Saml(p, _) => p,
26            SmtpMail::Soml(p, _) => p,
27        }
28    }
29}