From 11762728c9623474fecdd756d808172601320517 Mon Sep 17 00:00:00 2001 From: Priec Date: Fri, 19 Jun 2026 10:50:48 +0200 Subject: [PATCH] mail sent over test working fully now --- config/test.yaml | 4 +++- src/mailers/auth.rs | 12 +++++++++++- tests/mailer/smtp_send.rs | 7 +++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/config/test.yaml b/config/test.yaml index 2a30133..48335a6 100644 --- a/config/test.yaml +++ b/config/test.yaml @@ -67,7 +67,9 @@ mailer: # OAuth2 handshake, they just need the store to construct successfully. initializers: oauth2: - secret_key: 0123456789012345678901234567890123456789012345678901234567890123 + # Private-cookie key: a ", "-separated list of >=64 byte values (not a + # plain string). This is loco-oauth2's documented sample key; fine for tests. + secret_key: "144, 76, 183, 1, 15, 184, 233, 174, 214, 251, 190, 186, 122, 61, 74, 84, 225, 110, 189, 115, 10, 251, 133, 128, 52, 46, 15, 66, 85, 1, 245, 73, 27, 113, 189, 15, 209, 205, 61, 100, 73, 31, 18, 58, 235, 105, 141, 36, 70, 92, 231, 151, 27, 32, 243, 117, 30, 244, 110, 89, 233, 196, 137, 130" authorization_code: - client_identifier: google client_credentials: diff --git a/src/mailers/auth.rs b/src/mailers/auth.rs index 1d95180..651cd81 100644 --- a/src/mailers/auth.rs +++ b/src/mailers/auth.rs @@ -13,7 +13,17 @@ static set_password: Dir<'_> = include_dir!("src/mailers/auth/set_password"); #[allow(clippy::module_name_repetitions)] pub struct AuthMailer {} -impl Mailer for AuthMailer {} +impl Mailer for AuthMailer { + /// Override the framework default (`System `), which any + /// real MX rejects (`example.com` is nullMX). Must be a sender the SMTP + /// account is allowed to send as. + fn opts() -> mailer::MailerOpts { + mailer::MailerOpts { + from: "Kompress ".to_string(), + ..Default::default() + } + } +} impl AuthMailer { /// Sending welcome email the the given user /// diff --git a/tests/mailer/smtp_send.rs b/tests/mailer/smtp_send.rs index 2f38dad..70f4e60 100644 --- a/tests/mailer/smtp_send.rs +++ b/tests/mailer/smtp_send.rs @@ -28,13 +28,16 @@ use serial_test::serial; // Non-secret production SMTP settings (mirror `.env`). The password is // intentionally NOT here: it is supplied at runtime via `SMTP_PASSWORD` // (direnv -> `pass`), and never committed. -const SMTP_HOST: &str = "smtp.kompress.sk"; +// Dial the name the TLS cert is actually valid for. `smtp.kompress.sk` is a +// DNS alias for the same server (213.215.124.101) but the cert only lists +// smtp.euronet.sk, so connecting via the alias fails certificate validation. +const SMTP_HOST: &str = "smtp.euronet.sk"; const SMTP_PORT: &str = "587"; const SMTP_USER: &str = "kompres"; const SMTP_SECURE: &str = "true"; // Where the test email is sent. Override with `MAILER_TEST_TO`. -const DEFAULT_RECIPIENT: &str = "filipriec@gmail.com"; +const DEFAULT_RECIPIENT: &str = "filippriec@tutanota.com"; #[tokio::test] #[serial]