diff --git a/booking.emails.inc b/booking.emails.inc index 9f92b19..25864cc 100644 --- a/booking.emails.inc +++ b/booking.emails.inc @@ -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'))); } diff --git a/booking.module b/booking.module index 89d0cf8..f19ac32 100644 --- a/booking.module +++ b/booking.module @@ -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().