function simplenews_build_subscribe_mail in Simplenews 7
Same name and namespace in other branches
- 7.2 includes/simplenews.mail.inc \simplenews_build_subscribe_mail()
Build subject and body of the subscribe confirmation email.
Parameters
array $message: Message array as used by hook_mail().
array $params: Parameter array as used by hook_mail().
1 call to simplenews_build_subscribe_mail()
- simplenews_mail in ./
simplenews.module - Implements hook_mail().
File
- includes/
simplenews.mail.inc, line 808 - Simplenews email send and spool handling
Code
function simplenews_build_subscribe_mail(&$message, $params) {
$context = $params['context'];
$langcode = $message['language'];
// Use formatted from address "name" <mail_address>
$message['headers']['From'] = $params['from']['formatted'];
$message['subject'] = simplenews_subscription_confirmation_text('subscribe_subject', $langcode);
$message['subject'] = token_replace($message['subject'], $context, array(
'sanitize' => FALSE,
));
if (simplenews_user_is_subscribed($context['simplenews_subscriber']->mail, $context['category']->tid)) {
$body = simplenews_subscription_confirmation_text('subscribe_subscribed', $langcode);
}
else {
$body = simplenews_subscription_confirmation_text('subscribe_unsubscribed', $langcode);
}
$message['body'][] = token_replace($body, $context, array(
'sanitize' => FALSE,
));
}