Start collecting recipients

- Collect recipients for processed email.
- Add proper email parsing
This commit is contained in:
Malte Meiboom
2025-12-11 11:53:55 +01:00
parent 49c1b99b5a
commit 23c698f445
5 changed files with 85 additions and 15 deletions
+22
View File
@@ -0,0 +1,22 @@
//
// Husk milter
//
// mail functions
//
use std::ffi::CString;
use sequoia_openpgp::packet::UserID;
pub fn to_userid(rcpt: &CString) -> Option<UserID> {
match rcpt.to_str() {
Ok(s) => Some(UserID::from(s)),
_ => None
}
}
pub fn to_email(rcpt: &CString) -> Option<String> {
if let Some(u) = to_userid(rcpt) {
if let Ok(Some(e)) = u.email() { Some(e.to_string()) }
else { None }
} else { None }
}