public function SmtpMailSystem::format in SMTP Authentication Support 7
Same name and namespace in other branches
- 7.2 smtp.mail.inc \SmtpMailSystem::format()
Concatenate and wrap the e-mail body for either plain-text or HTML emails.
Parameters
$message: A message array, as described in hook_mail_alter().
Return value
The formatted $message.
Overrides MailSystemInterface::format
File
- ./
smtp.mail.inc, line 25 - The code processing mail in the smtp module.
Class
- SmtpMailSystem
- Modify the drupal mail system to use smtp when sending emails. Include the option to choose between plain text or HTML
Code
public function format(array $message) {
$this->AllowHtml = variable_get('smtp_allowhtml', 0);
// Join the body array into one string.
$message['body'] = implode("\n\n", $message['body']);
if ($this->AllowHtml == 0) {
// Convert any HTML to plain-text.
$message['body'] = drupal_html_to_text($message['body']);
// Wrap the mail body for sending.
$message['body'] = drupal_wrap_mail($message['body']);
}
return $message;
}