diff --git a/docroot/modules/custom/foia_webform/src/Plugin/Mail/CustomHtmlSymfonyMailer.php b/docroot/modules/custom/foia_webform/src/Plugin/Mail/CustomHtmlSymfonyMailer.php new file mode 100644 index 000000000..a95d8d011 --- /dev/null +++ b/docroot/modules/custom/foia_webform/src/Plugin/Mail/CustomHtmlSymfonyMailer.php @@ -0,0 +1,60 @@ +getHeaders(); + foreach ($message['headers'] as $name => $value) { + if (!in_array(strtolower($name), ['content-type', 'content-transfer-encoding'], TRUE)) { + $headers->addHeader($name, $value); + } + } + + $recipients = array_map(trim(...), str_getcsv($message['to'], escape: "\\")); + + $email + ->to(...$recipients) + ->subject($message['subject']) + ->html($message['body']); + + $mailer = $this->getMailer(); + $mailer->send($email); + + return TRUE; + } + catch (\Exception $e) { + Error::logException($this->logger, $e); + return FALSE; + } + } + +}