From 0c188ea0f0068d5f7ff3b4be97e6bf17318c5767 Mon Sep 17 00:00:00 2001 From: psserver Date: Fri, 15 Sep 2017 12:27:32 +1200 Subject: [PATCH 1/2] Admin emails --- site/code/DataObjects/FormSubmission.php | 16 ++++++++-------- site/code/Extensions/SiteConfigExtension.php | 14 ++++++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/site/code/DataObjects/FormSubmission.php b/site/code/DataObjects/FormSubmission.php index 210c955..aa6015e 100644 --- a/site/code/DataObjects/FormSubmission.php +++ b/site/code/DataObjects/FormSubmission.php @@ -86,8 +86,8 @@ public function SendEmails(){ case 'ContactPage': // --- ADMIN EMAIL --- - if( isset($this->Origin()->AdminEmail) ){ - $to = $this->Origin()->AdminEmail; + if( isset($this->Origin()->ToEmail) ){ + $to = $this->Origin()->ToEmail; }else{ $to = $config->SendEmailsTo_Email; } @@ -119,12 +119,12 @@ public function SendEmails(){ $email->send(); // --- CUSTOMER EMAIL --- - $to = '"'.$data->Name.'" <'.$data->Email.'>'; - $data->Title = 'Thanks for your message, we\'ll be in touch soon. The details you submitted are included below for your own records.'; - $email = Email::create($from, $to, $subject, $body); - $email->setTemplate('Emails/FormSubmission'); - $email->populateTemplate( ArrayData::create($data) ); - $email->send(); + // $to = '"'.$data->Name.'" <'.$data->Email.'>'; + // $data->Title = 'Thanks for your message, we\'ll be in touch soon. The details you submitted are included below for your own records.'; + // $email = Email::create($from, $to, $subject, $body); + // $email->setTemplate('Emails/FormSubmission'); + // $email->populateTemplate( ArrayData::create($data) ); + // $email->send(); break; diff --git a/site/code/Extensions/SiteConfigExtension.php b/site/code/Extensions/SiteConfigExtension.php index 8d444cf..f3c6222 100644 --- a/site/code/Extensions/SiteConfigExtension.php +++ b/site/code/Extensions/SiteConfigExtension.php @@ -2,23 +2,29 @@ class SiteConfigExtension extends DataExtension { static $db = array( - 'AdminToEmails' => 'Text', - 'AdminFromEmail' => 'Text' + 'SendEmailsTo_Email' => 'Text', + 'SendEmailsFrom_Name' => 'Text', + 'SendEmailsFrom_Email' => 'Text' ); public function updateCMSFields(FieldList $fields){ $fields->addFieldToTab( 'Root.Emails', - TextAreaField::create('AdminToEmails','Admin "To" email address(es)') + TextAreaField::create('SendEmailsTo_Email','Admin "To" email address(es)') ->setDescription('Email addresses for deliver of global admin emails eg, contact form submissions etc.
Can be comma-separated list.') ); $fields->addFieldToTab( 'Root.Emails', - TextField::create('AdminFromEmail','Admin "From" email address') + TextField::create('SendEmailsFrom_Email','Admin "From" email address') ->setDescription('Email addresses for global admin emails to come "From"') ); + $fields->addFieldToTab( + 'Root.Emails', + TextField::create('SendEmailsFrom_Name','Admin "From" email name') + ->setDescription('Name for global admin emails to come "From"') + ); } From 33fd51b0e850ed304a5df42716eb9cb87554928d Mon Sep 17 00:00:00 2001 From: psserver Date: Fri, 15 Sep 2017 12:32:39 +1200 Subject: [PATCH 2/2] Email logo --- site/code/DataObjects/FormSubmission.php | 2 +- site/templates/email/FormSubmission.ss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site/code/DataObjects/FormSubmission.php b/site/code/DataObjects/FormSubmission.php index aa6015e..8a7c91b 100644 --- a/site/code/DataObjects/FormSubmission.php +++ b/site/code/DataObjects/FormSubmission.php @@ -92,7 +92,7 @@ public function SendEmails(){ $to = $config->SendEmailsTo_Email; } $subject = $config->Title . ' Website contact form submission'; - $data->Title = $data->Name . ' has made an enquiry.'; + $data->Title = $data->Name . ' has made an enquiry through the contact form on divinelaziness.com'; $data->URL = Director::absoluteBaseURL(); $data->Data = ArrayList::create(array( ArrayData::create(array( diff --git a/site/templates/email/FormSubmission.ss b/site/templates/email/FormSubmission.ss index 2509ad9..42bafa1 100644 --- a/site/templates/email/FormSubmission.ss +++ b/site/templates/email/FormSubmission.ss @@ -5,7 +5,7 @@
- +