From 612451cfc9cad51cd0e3913262c9ab5a601a55c9 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 8 Nov 2024 13:05:14 -0600 Subject: [PATCH] updates to the ui and email system --- layouts/shortcodes/mt-form.html | 4 ++-- src/api/mt_form.rs | 6 +++--- src/email.rs | 11 +++++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/layouts/shortcodes/mt-form.html b/layouts/shortcodes/mt-form.html index 95805b7..8eea841 100644 --- a/layouts/shortcodes/mt-form.html +++ b/layouts/shortcodes/mt-form.html @@ -12,7 +12,7 @@ const age = calculate_age(birthdate); data.append("age", age); - let base = "https://api.tfcconnection.org/mt-form"; + let base = "/api/mt-form"; /* let base = "http://localhost:4242/mt-form"; */ fetch(base, { @@ -78,7 +78,7 @@
) -> HttpResponse { let first = form.first_name.clone(); let last = form.last_name.clone(); @@ -269,11 +269,11 @@ pub async fn mt_form(MultipartForm(form): MultipartForm) -> HttpResponse .unwrap(), ) .to("Chris Cochrun ".parse().unwrap()) - .to("Ethan Rose ".parse().unwrap()) .subject(email_subject) .multipart(multi) { - let _ = crate::email::send_email(m).await; + let future = crate::email::send_email(m); + actix_rt::spawn(future); } else { error!("Email incorrect"); } diff --git a/src/email.rs b/src/email.rs index 4ca21e7..6ce5a35 100644 --- a/src/email.rs +++ b/src/email.rs @@ -17,10 +17,13 @@ pub async fn send_email(message: Message) -> Result<()> { .build(); match sender.send(&message) { - Ok(res) => info!( - "Successfully sent email to server with this response: {:?}", - res - ), + Ok(res) => { + let res: String = res.message().collect(); + info!( + "Successfully sent email to server with this response: {:?}", + res + ) + } Err(e) => error!("There was an error sending the email: {e}"), } Ok(())