feat: update to match stalwart, and add onion

This commit is contained in:
Jet 2026-03-19 01:25:14 -07:00
parent 55a862fabb
commit ede986080a
No known key found for this signature in database
9 changed files with 277 additions and 56 deletions

View file

@ -6,6 +6,7 @@ pub fn send_notification(
id: i64,
question: &str,
notify_email: &str,
mail_domain: &str,
) -> Result<(), Box<dyn std::error::Error>> {
let truncated = if question.len() > 50 {
format!("{}...", &question[..50])
@ -13,8 +14,8 @@ pub fn send_notification(
question.to_string()
};
let from: Mailbox = "Q&A <qa@extremist.software>".parse()?;
let reply_to: Mailbox = format!("qa+{id}@extremist.software").parse()?;
let from: Mailbox = format!("Q&A <qa@{mail_domain}>").parse()?;
let reply_to: Mailbox = format!("qa+{id}@{mail_domain}").parse()?;
let to: Mailbox = notify_email.parse()?;
let email = Message::builder()
@ -26,7 +27,9 @@ pub fn send_notification(
let mailer = SmtpTransport::builder_dangerous("localhost")
.tls(Tls::None)
.hello_name(lettre::transport::smtp::extension::ClientId::Domain("extremist.software".to_string()))
.hello_name(lettre::transport::smtp::extension::ClientId::Domain(
mail_domain.to_string(),
))
.build();
mailer.send(&email)?;