You are here

function multiple_email_expire_address in Multiple E-mail Addresses 2.x

Same name and namespace in other branches
  1. 5 multiple_email.module \multiple_email_expire_address()
  2. 6 multiple_email.module \multiple_email_expire_address()
  3. 7 multiple_email.module \multiple_email_expire_address()

Removes the specified address from the user who added it and sends their primary e-mail account a message notifying them about the expiration.

Parameters

integer $eid:

1 call to multiple_email_expire_address()
multiple_email_cron in ./multiple_email.module
Implements hook_cron().

File

./multiple_email.module, line 620
multiple_email module file

Code

function multiple_email_expire_address($eid) {
  global $language;
  $email = multiple_email_load($eid);
  multiple_email_delete_email($eid);
  $from = variable_get('site_mail', ini_get('sendmail_from'));
  $account = user_load($email->uid);
  $params = array(
    'headers' => array(),
    'subject' => multiple_email_message_part('subject', 'expire', $account, $email),
    'body' => multiple_email_message_part('body', 'expire', $account, $email),
  );
  drupal_mail('multiple_email', 'expiration', $account->mail, $language, $params, $from);
  watchdog('Multiple E-mail', '@email (@eid) for @name (@uid) has expired and been removed', array(
    '@email' => $email->email,
    '@eid' => $email->eid,
    '@name' => $account->name,
    '@uid' => $account->uid,
  ));
}