pub async fn send_contact_email(&self, contact: crate::models::ContactEmail) -> Result<()> {
let phone_str = contact.phone.as_deref().unwrap_or("Not provided");
let html_body = format!(
"
New Contact Form Submission
\n\
Name: {} {}
\n\
Email: {}
\n\
Phone: {}
\n\
Message:
\n\
{}
\n",
contact.first_name,
contact.last_name,
contact.email,
phone_str,
contact.message.replace('\n', "
")
);
let email = Message::builder()
.from(self.config.from_email.parse()?)
.to(self.config.admin_email.parse()?)
.subject(format!("New Contact Form Submission from {} {}",
contact.first_name, contact.last_name))
.body(html_body)?;
self.transport.send(email).await?;
tracing::info!("Contact form email sent successfully");
Ok(())
}