You are here

function simplenews_confirmation_send in Simplenews 7

Same name and namespace in other branches
  1. 7.2 simplenews.module \simplenews_confirmation_send()

Send a confirmation mail.

Either sends a mail immediatly or collects them for a combined mail.

Parameters

$action: The confirmation type, either subscribe or unsubscribe.

$subscriber: The subscriber object.

$category: The newsletter category object.

2 calls to simplenews_confirmation_send()
simplenews_subscribe_user in ./simplenews.module
Subscribe a user to a newsletter or send a confirmation mail.
simplenews_unsubscribe_user in ./simplenews.module
Unsubscribe a user from a mailing list or send a confirmation mail.

File

./simplenews.module, line 2873
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_confirmation_send($action, $subscriber, $category) {

  // Check if confirmation should be sent immediatly or grouped.
  if (simplenews_confirmation_combine()) {
    simplenews_confirmation_add_combined($action, $subscriber, $category);
  }
  else {

    // Send confirmation email to user to complete (un)subscription.
    // Confirmation mail is in the user preferred language which is by default the
    // language_default().
    module_load_include('inc', 'simplenews', 'includes/simplenews.mail');
    $params['from'] = _simplenews_set_from();
    $params['context']['category'] = $category;
    $params['context']['simplenews_subscriber'] = $subscriber;
    drupal_mail('simplenews', $action, $subscriber->mail, $subscriber->language, $params, $params['from']['address']);
  }
}