
Complete church management system with bulletin management, media processing, live streaming integration, and web interface. Includes authentication, email notifications, database migrations, and comprehensive test suite.
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
|
|
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!(
|
|
"<h2>New Contact Form Submission</h2>\n\
|
|
<p><strong>Name:</strong> {} {}</p>\n\
|
|
<p><strong>Email:</strong> {}</p>\n\
|
|
<p><strong>Phone:</strong> {}</p>\n\
|
|
<h3>Message:</h3>\n\
|
|
<p>{}</p>\n",
|
|
contact.first_name,
|
|
contact.last_name,
|
|
contact.email,
|
|
phone_str,
|
|
contact.message.replace('\n', "<br>")
|
|
);
|
|
|
|
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(())
|
|
}
|