function DevelMailLog::composeMessage
Same name in other branches
- 7.x-1.x devel.mail.inc \DevelMailLog::composeMessage()
- 8.x-1.x src/Plugin/Mail/DevelMailLog.php \Drupal\devel\Plugin\Mail\DevelMailLog::composeMessage()
- 5.x src/Plugin/Mail/DevelMailLog.php \Drupal\devel\Plugin\Mail\DevelMailLog::composeMessage()
Compose the output message.
Parameters
array $message: A message array, as described in hook_mail_alter().
Return value
string The output message.
1 call to DevelMailLog::composeMessage()
- DevelMailLog::mail in src/
Plugin/ Mail/ DevelMailLog.php - Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail().
File
-
src/
Plugin/ Mail/ DevelMailLog.php, line 137
Class
- DevelMailLog
- Defines a mail backend that saves emails as temporary files.
Namespace
Drupal\devel\Plugin\MailCode
protected function composeMessage(array $message) {
$mimeheaders = [];
$message['headers']['To'] = $message['to'];
foreach ($message['headers'] as $name => $value) {
$mimeheaders[] = $name . ': ' . Unicode::mimeHeaderEncode($value);
}
$line_endings = Settings::get('mail_line_endings', PHP_EOL);
$output = implode($line_endings, $mimeheaders) . $line_endings;
// 'Subject:' is a mail header and should not be translated.
$output .= 'Subject: ' . $message['subject'] . $line_endings;
// Blank line to separate headers from body.
$output .= $line_endings;
$output .= preg_replace('@\\r?\\n@', $line_endings, $message['body']);
return $output;
}