function yamlform_mail_alter in YAML Form 8
Implements hook_mail_alter().
File
- ./
yamlform.module, line 238 - Enables the creation of forms and questionnaires.
Code
function yamlform_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 EmailYamlFormHandler's
// 'html' flag has been set.
// @see \Drupal\Core\Mail\MailManager::mail()
// @see \Drupal\yamlform\Plugin\YamlFormHandler\EmailYamlFormHandler::getMessage().
if (strpos($message['id'], 'yamlform') === 0) {
if ($message['params']['html']) {
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
}
}
}