fix: fixed wrong email address (#3884)

* Fix wrong email address

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Decouple SMTP auth identity from message sender

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Add new configurations to .env file

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Update mod.rs

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Remove unused import

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Give SMTP_FROM_ADDRESS a default value

Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Add the correct host name

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Fix CI failure

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

* Update mod.rs

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>

---------

Signed-off-by: Ken <131881470+Keniis0712@users.noreply.github.com>
Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
Co-authored-by: Emma Alexia <emma@modrinth.com>
This commit is contained in:
Ken
2025-07-03 23:41:13 +08:00
committed by GitHub
parent 8e35cf6957
commit 9dc5644264
2 changed files with 9 additions and 5 deletions

View File

@@ -85,6 +85,8 @@ TREMENDOUS_CAMPAIGN_ID=none
HCAPTCHA_SECRET=none
SMTP_FROM_NAME=Modrinth
SMTP_FROM_ADDRESS=no-reply@mail.modrinth.com
SMTP_USERNAME=none
SMTP_PASSWORD=none
SMTP_HOST=none

View File

@@ -2,7 +2,7 @@ use lettre::message::Mailbox;
use lettre::message::header::ContentType;
use lettre::transport::smtp::authentication::Credentials;
use lettre::transport::smtp::client::{Tls, TlsParameters};
use lettre::{Address, Message, SmtpTransport, Transport};
use lettre::{Message, SmtpTransport, Transport};
use thiserror::Error;
use tracing::warn;
@@ -23,11 +23,13 @@ pub fn send_email_raw(
subject: String,
body: String,
) -> Result<(), MailError> {
let from_name = dotenvy::var("SMTP_FROM_NAME")
.unwrap_or_else(|_| "Modrinth".to_string());
let from_address = dotenvy::var("SMTP_FROM_ADDRESS")
.unwrap_or_else(|_| "no-reply@mail.modrinth.com".to_string());
let email = Message::builder()
.from(Mailbox::new(
Some("Modrinth".to_string()),
Address::new("no-reply", "mail.modrinth.com")?,
))
.from(Mailbox::new(Some(from_name), from_address.parse()?))
.to(to.parse()?)
.subject(subject)
.header(ContentType::TEXT_HTML)