From 1cc41bf0026c4a3e4af2678ac4a60dc8e1df7b29 Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Mon, 7 Oct 2024 14:42:22 -0700 Subject: [PATCH 1/3] Added contact-form.php config file Added contact-form.php config file --- api/config/contact-form.php | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 api/config/contact-form.php diff --git a/api/config/contact-form.php b/api/config/contact-form.php new file mode 100644 index 00000000..3523c457 --- /dev/null +++ b/api/config/contact-form.php @@ -0,0 +1,43 @@ +request; + +// 'toEmail' => 'bond@007.com', // override this one with env vars + +if (!$request->getIsConsoleRequest()) { + $topic = $request->getBodyParam("topic"); + $to_list = null; + + if($topic != null) { + switch($topic) { + case "website_feedback": + $to_list = "eric.rosas@noirlab.edu;ericdrosas@gmail.com"; + break; + case "general": + $to_list = "erosas@lsst.org;ericdrosas@gmail.com"; + break; + case "education": + $to_list = "agoff@lsst.org;ericdrosas@gmail.com"; + break; + case "media": + $to_list = "alexandra.goff@noirlab.edu;ericdrosas@gmail.com"; + break; + case "site_visit": + $to_list = "ericdrosas@gmail.com"; + break; + default: + $to_list = "ericdrosas@gmail.com"; + break; + } + + Craft::info("to_list : $to_list", "Maddie"); + return [ + 'toEmail' => $to_list + ]; + } + +} + + From a7f7564b42a489d8c857d5c45e72ced2236888da Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Mon, 7 Oct 2024 14:46:46 -0700 Subject: [PATCH 2/3] Changed semicolans to commas for email lists Changes semicolans to commas for email lists --- api/config/contact-form.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/config/contact-form.php b/api/config/contact-form.php index 3523c457..28505050 100644 --- a/api/config/contact-form.php +++ b/api/config/contact-form.php @@ -13,16 +13,16 @@ if($topic != null) { switch($topic) { case "website_feedback": - $to_list = "eric.rosas@noirlab.edu;ericdrosas@gmail.com"; + $to_list = "eric.rosas@noirlab.edu,ericdrosas@gmail.com"; break; case "general": - $to_list = "erosas@lsst.org;ericdrosas@gmail.com"; + $to_list = "erosas@lsst.org,ericdrosas@gmail.com"; break; case "education": - $to_list = "agoff@lsst.org;ericdrosas@gmail.com"; + $to_list = "agoff@lsst.org,ericdrosas@gmail.com"; break; case "media": - $to_list = "alexandra.goff@noirlab.edu;ericdrosas@gmail.com"; + $to_list = "alexandra.goff@noirlab.edu,ericdrosas@gmail.com"; break; case "site_visit": $to_list = "ericdrosas@gmail.com"; From 78d5d9d3b622bca87804f7a69319cca0ad71161c Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Mon, 7 Oct 2024 16:47:47 -0700 Subject: [PATCH 3/3] Changed hardcoded emails to env vars for contact f Changed hardcoded emails to env vars for contact form --- api/config/contact-form.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/api/config/contact-form.php b/api/config/contact-form.php index 28505050..520ea193 100644 --- a/api/config/contact-form.php +++ b/api/config/contact-form.php @@ -1,11 +1,10 @@ request; -// 'toEmail' => 'bond@007.com', // override this one with env vars - if (!$request->getIsConsoleRequest()) { $topic = $request->getBodyParam("topic"); $to_list = null; @@ -13,22 +12,21 @@ if($topic != null) { switch($topic) { case "website_feedback": - $to_list = "eric.rosas@noirlab.edu,ericdrosas@gmail.com"; + $to_list = App::env('CONTACT_FORM_TO_ADDRESSES_FOR_FEEDBACK'); break; case "general": - $to_list = "erosas@lsst.org,ericdrosas@gmail.com"; + $to_list = App::env('CONTACT_FORM_TO_ADDRESSES_FOR_GENERAL'); break; case "education": - $to_list = "agoff@lsst.org,ericdrosas@gmail.com"; + $to_list = App::env('CONTACT_FORM_TO_ADDRESSES_FOR_EDUCATION'); break; case "media": - $to_list = "alexandra.goff@noirlab.edu,ericdrosas@gmail.com"; + $to_list = App::env('CONTACT_FORM_TO_ADDRESSES_FOR_MEDIA'); break; case "site_visit": - $to_list = "ericdrosas@gmail.com"; + $to_list = App::env('CONTACT_FORM_TO_ADDRESSES_FOR_VISITS'); break; default: - $to_list = "ericdrosas@gmail.com"; break; }