HTML and plain text for new post mail notifications

This commit is contained in:
Alphonse Paix
2025-09-21 03:45:29 +02:00
parent 56b25515f9
commit 0725b87bf2
5 changed files with 222 additions and 25 deletions

View File

@@ -33,12 +33,8 @@ impl EmailClient {
) -> Result<(), reqwest::Error> {
let url = self.base_url.join("email").unwrap();
let request_body = SendEmailRequest {
from: EmailField {
email: self.sender.as_ref(),
},
to: vec![EmailField {
email: recipient.as_ref(),
}],
from: self.sender.as_ref(),
to: recipient.as_ref(),
subject,
text: text_content,
html: html_content,
@@ -61,18 +57,13 @@ impl EmailClient {
#[derive(serde::Serialize)]
struct SendEmailRequest<'a> {
from: EmailField<'a>,
to: Vec<EmailField<'a>>,
from: &'a str,
to: &'a str,
subject: &'a str,
text: &'a str,
html: &'a str,
}
#[derive(serde::Serialize)]
struct EmailField<'a> {
email: &'a str,
}
#[cfg(test)]
mod tests {
use crate::{