public function BusinessRulesMail::format in Business Rules 8
Same name and namespace in other branches
- 2.x src/Plugin/Mail/BusinessRulesMail.php \Drupal\business_rules\Plugin\Mail\BusinessRulesMail::format()
Formats a message composed by drupal_mail().
Parameters
array $message: A message array holding all relevant details for the message.
Return value
array The message as it should be sent.
Overrides PhpMail::format
File
- src/
Plugin/ Mail/ BusinessRulesMail.php, line 29
Class
- BusinessRulesMail
- Provides a 'Business Rules Mail' plugin to send emails.
Namespace
Drupal\business_rules\Plugin\MailCode
public function format(array $message) {
// Join the body array into one string.
$message['body'] = implode("\n\n", $message['body']);
if (!isset($message['headers']) || !isset($message['headers']['Content-Type']) || !stristr($message['headers']['Content-Type'], 'text/html')) {
// Convert any HTML to plain-text.
$message['body'] = MailFormatHelper::htmlToText($message['body']);
// Wrap the mail body for sending.
$message['body'] = MailFormatHelper::wrapMail($message['body']);
}
return $message;
}