You are here

function webform_confirm_email_mail_alter in Webform Confirm Email Address 6

Same name and namespace in other branches
  1. 6.3 webform_confirm_email.module \webform_confirm_email_mail_alter()
  2. 6.2 webform_confirm_email.module \webform_confirm_email_mail_alter()
  3. 7.2 webform_confirm_email.module \webform_confirm_email_mail_alter()
  4. 7 webform_confirm_email.module \webform_confirm_email_mail_alter()

Implementation of hook_mail_alter().

Parameters

$message: The message originally sent from the webform that we're going to send after email address confirmation.

File

./webform_confirm_email.module, line 245
Add email confirmation rules to webforms used as letter campaigns

Code

function webform_confirm_email_mail_alter(&$message) {
  $confirm_url = _webform_confirm_email_store_message($message);
  if (!$confirm_url) {
    return;
  }

  // rewrite message to get email address confirmation first
  $to = $message['to'];
  $message['to'] = $message['from'];
  $message['from'] = variable_get('site_mail', NULL);
  $message['subject'] = t('Confirmation email');
  $message['body'][0] = t("You must confirm this is really your email address to send a letter to !to.", array(
    '!to' => $to,
  ));
  $message['body'][1] = t("Visit !confirm_url to confirm it.", array(
    '!confirm_url' => $confirm_url,
  ));
}