Better email title + translation
This commit is contained in:
parent
c7b6f58655
commit
9874497469
5 changed files with 18 additions and 3 deletions
|
|
@ -17,8 +17,12 @@ pub enum Error {
|
|||
#[error("Email error: {0}")]
|
||||
Email(#[from] lettre::error::Error),
|
||||
}
|
||||
|
||||
/// A function to send an email using the given SMTP address.
|
||||
/// It may timeout if the SMTP server is not reachable, see [const::SEND_EMAIL_TIMEOUT].
|
||||
pub async fn send_email(
|
||||
email: &str,
|
||||
title: &str,
|
||||
message: &str,
|
||||
smtp_relay_address: &str,
|
||||
smtp_login: &str,
|
||||
|
|
@ -26,9 +30,9 @@ pub async fn send_email(
|
|||
) -> Result<(), Error> {
|
||||
let email = Message::builder()
|
||||
.message_id(None)
|
||||
.from("recipes@gburri.org".parse()?)
|
||||
.from("recipes@recipes.gburri.org".parse()?)
|
||||
.to(email.parse()?)
|
||||
.subject("recipes.gburri.org account validation")
|
||||
.subject(title)
|
||||
.body(message.to_string())?;
|
||||
|
||||
let credentials = Credentials::new(smtp_login.to_string(), smtp_password.to_string());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue