You are here

function multiple_email_expire_address in Multiple E-mail Addresses 6

Same name and namespace in other branches
  1. 5 multiple_email.module \multiple_email_expire_address()
  2. 7 multiple_email.module \multiple_email_expire_address()
  3. 2.x 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
Implementation of hook_cron().

File

./multiple_email.module, line 659
multiple_email module file

Code

function multiple_email_expire_address($eid) {
  global $language;
  $email = multiple_email_load($eid);
  $account = user_load(array(
    'uid' => $email->uid,
  ));
  $params = array(
    'subject' => multiple_email_message_part('subject', 'expire', $account, $email),
    'body' => multiple_email_message_part('body', 'expire', $account, $email),
  );
  multiple_email_delete_email($eid);
  $from = variable_get('site_mail', ini_get('sendmail_from'));
  drupal_mail('multiple_email_expire', 'expire_address_mail', $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,
  ));
}