function simplenews_build_newsletter_mail in Simplenews 7.2
Same name and namespace in other branches
- 7 includes/simplenews.mail.inc \simplenews_build_newsletter_mail()
Build subject and body of the test and normal newsletter email.
Parameters
array $message: Message array as used by hook_mail().
array $source: The SimplenewsSource instance.
Related topics
1 call to simplenews_build_newsletter_mail()
- simplenews_mail in ./
simplenews.module - Implements hook_mail().
File
- includes/
simplenews.mail.inc, line 805 - Simplenews email send and spool handling
Code
function simplenews_build_newsletter_mail(&$message, SimplenewsSourceInterface $source) {
// Get message data from source.
$message['headers'] = $source
->getHeaders($message['headers']);
$message['subject'] = $source
->getSubject();
$message['body']['body'] = $source
->getBody();
$message['body']['footer'] = $source
->getFooter();
// Optional params for HTML mails.
if ($source
->getFormat() == 'html') {
$message['params']['plain'] = NULL;
$message['params']['plaintext'] = $source
->getPlainBody() . "\n" . $source
->getPlainFooter();
$message['params']['attachments'] = $source
->getAttachments();
}
else {
$message['params']['plain'] = TRUE;
}
}