BREAKING CHANGE(smartmta): Rebrand package to @push.rocks/smartmta, add consolidated email security verification and IPC handler
This commit is contained in:
@@ -23,6 +23,28 @@ impl SpfResult {
|
||||
pub fn passed(&self) -> bool {
|
||||
self.result == "pass"
|
||||
}
|
||||
|
||||
/// Create an `SpfResult` from a raw `mail-auth` `SpfOutput`.
|
||||
///
|
||||
/// Used by the compound `verify_email_security` to avoid re-doing the SPF query.
|
||||
pub fn from_output(output: &mail_auth::SpfOutput, ip: IpAddr) -> Self {
|
||||
let result_str = match output.result() {
|
||||
MailAuthSpfResult::Pass => "pass",
|
||||
MailAuthSpfResult::Fail => "fail",
|
||||
MailAuthSpfResult::SoftFail => "softfail",
|
||||
MailAuthSpfResult::Neutral => "neutral",
|
||||
MailAuthSpfResult::TempError => "temperror",
|
||||
MailAuthSpfResult::PermError => "permerror",
|
||||
MailAuthSpfResult::None => "none",
|
||||
};
|
||||
|
||||
SpfResult {
|
||||
result: result_str.to_string(),
|
||||
domain: output.domain().to_string(),
|
||||
ip: ip.to_string(),
|
||||
explanation: output.explanation().map(|s| s.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Check SPF for a given sender IP, HELO domain, and MAIL FROM address.
|
||||
|
||||
Reference in New Issue
Block a user