You are here

function simplenews_mail_confirm in Simplenews 5

Send confirmation email

2 calls to simplenews_mail_confirm()
simplenews_subscribe_user in ./simplenews.module
API function; subscribes a user to a newsletter.
simplenews_unsubscribe_user in ./simplenews.module
API function; unsubscribes a user from a newsletter.

File

./simplenews.module, line 1313

Code

function simplenews_mail_confirm($email, $newsletter, $snid = NULL, $op = NULL) {
  if (isset($snid) && isset($newsletter->tid)) {
    $hash = _simplenews_generate_hash($email, $snid, $newsletter->tid);
  }
  else {
    $hash = NULL;
  }
  $mail = theme('simplenews_newsletter_confirmation', $email, $newsletter, $snid, $op, $hash);
  if (simplenews_mail_send($mail)) {
    watchdog('newsletter', t('Sent confirmation e-mail to %mail.', array(
      '%mail' => $email,
    )));
  }
  else {
    watchdog('newsletter', t('Sending of confirmation e-mail to %mail failed.', array(
      '%mail' => $email,
    )), WATCHDOG_ERROR);
  }
}