theming of email body

This commit is contained in:
2017-06-27 12:17:54 +10:00
parent b1b900dfb3
commit 7e99092df7
2 changed files with 37 additions and 4 deletions

View File

@@ -31,17 +31,24 @@ function _booking_registration_email($nid, $balance_payment, $manual = false) {
//send the registering person an email
$to = $node->booking_email;
$body = _booking_registration_email_generate($node, $waiting_list, $balance_payment, $manual);
//$body = _booking_registration_email_generate($node, $waiting_list, $balance_payment, $manual);
//$params['body'] = $body;
if ($balance_payment == TRUE) {
$subject = t('!event Payment Complete', array('!event' => $event->booking_eventname));
}
else {
$subject = t('!event Registration', array('!event' => $event->booking_eventname));
}
$params['subject'] = $subject;
$params['body'] = $body;
//apply a theme to the HTML body of the email
$html_body = theme('booking_htmlmail_template',
array('variables' => array(
'body' => _booking_registration_email_generate($node, $waiting_list, $balance_payment, $manual),
)
));
$params['body'] = $html_body;
if (variable_get('booking_bcc_notify_email_workflow', 0) == 1) {
$params['headers']['Bcc'] = variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
}

View File

@@ -869,6 +869,32 @@ function booking_mail($key, &$message, $params) {
}
}
/**
* Implements hook_mail_alter()
*/
function booking_mail_alter(&$message) {
// $message['id'] comes from {module_name}_{email_key}
if($message['id'] == 'booking_registration_mail') {
$headers = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
'Content-Transfer-Encoding' => '8bit',
'X-Mailer' => 'Drupal',
);
}else{
$headers = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
'Content-Transfer-Encoding' => '8bit',
'X-Mailer' => 'Drupal',
);
}
//Overwrite header message header with Content-Type accommodating for html format
foreach($headers as $key => $value) {
$message['headers'][$key] = $value;
}
}
/**
* Implements hook_library().