function webform_mail_alter in Webform 8.5
Same name and namespace in other branches
- 6.x webform.module \webform_mail_alter()
Implements hook_mail_alter().
File
- ./
webform.module, line 479 - Enables the creation of webforms and questionnaires.
Code
function webform_mail_alter(&$message) {
// Drupal hardcodes all mail header as 'text/plain' so we need to set the
// header's 'Content-type' to HTML if the EmailWebformHandler's
// 'html' flag has been set.
// @see \Drupal\Core\Mail\MailManager::mail()
// @see \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::getMessage().
if (strpos($message['id'], 'webform') === 0) {
if (isset($message['params']['html']) && $message['params']['html']) {
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
}
}
}