diff --git a/src/mailer/email_sender.rs b/src/mailer/email_sender.rs index 17c1fb3a5..ba2da15c5 100644 --- a/src/mailer/email_sender.rs +++ b/src/mailer/email_sender.rs @@ -109,6 +109,10 @@ impl EmailSender { builder = builder.bcc(bcc.parse()?); } + if let Some(cc) = &email.cc { + builder = builder.cc(cc.parse()?); + } + if let Some(reply_to) = &email.reply_to { builder = builder.reply_to(reply_to.parse()?); } @@ -165,6 +169,7 @@ mod tests { text: "Welcome".to_string(), html: html.to_string(), bcc: None, + cc: None, }; assert!(sender.mail(&data).await.is_ok()); diff --git a/src/mailer/mod.rs b/src/mailer/mod.rs index 6c6f7302c..ab2244652 100644 --- a/src/mailer/mod.rs +++ b/src/mailer/mod.rs @@ -25,6 +25,7 @@ pub struct Args { pub reply_to: Option, pub locals: serde_json::Value, pub bcc: Option, + pub cc: Option, } /// The structure representing an email details. @@ -44,6 +45,8 @@ pub struct Email { pub html: String, /// BCC header to message pub bcc: Option, + /// CC header to message + pub cc: Option, } /// The options struct for configuring the email sender. @@ -95,6 +98,7 @@ pub trait Mailer { text: content.text, html: content.html, bcc: args.bcc.clone(), + cc: args.cc.clone(), }, ) .await