Simple question, though I cannot find the answer anywhere --

How does one specify multiple addresses for the primary administrator account in Drupal 7?

Put another way -- how does one make Drupal administrator emails go to multiple people, without setting up a bunch of forwarding filters on the mailserver?



This is much similar to Pontus's answer but in a different approach. and I have tested this and it worked on a Ubuntu server email program (not through an external SMTP server but it should work in a decent program). Pontus's solution will work as it seems. But recipient will see both email addresses. A good approach would be to set the BCC address (Blind Carbon Copy) instead of a new CC.

If you are not willing to make a module, I'd suggest http://drupal.org/project/maillog .

function MYMODULE_mail_alter(&$message) {
 if (-- enter your condition here -- ) {
   $message['headers']['BCC'] = $message['headers']['Bcc'] = 'hidden@example.com';

Note that now you have opened a serious security risk that hidden@example.com can now see any email, including password reset email address for the super user. So don't forget to add some condition using $message['id] that contains the message's ID.

You can make the module fancy and really usable by adding some sort of system_settings_form()'d form and a few variable_get().

Also, if the purpose of this is to send multiple emails on new security releases for modules, don't forget that you can add multiple email addresses in settings out-of-the-box.

  • Apologies for the delay. Good answer; security caveat appreciated! – aendrew Jan 1 '14 at 1:11
  • @AyeshK Hi! Can you explain how the Mail Log modules solves this? Also, could explain how to send to multiple email address for module updates? Thanks! – Sam Dec 2 '16 at 0:59

I haven't hit this problem before but the only way I can think of is to implement hook_mail_alter().

Untested code but I think it would look something like this:

    function MYMODULE_mail_alter(&$message) {
      $additional_emails = ',extra@extra.com';
      $site_mail = variable_get('site_mail', '');
      if ($message['to'] == $site_mail) {
          $message['to'] = $site_mail . $additional_admins;

The "Multiple Email" module does not appear to send to multiple email addresses within the user profile. The below code checks (a) if the user role is not "administrator", then checks if there are email values in a "home_email" field and "email_for_text_messages" field, and sends emails to these addresses in addition to the profile's default email field.

function MYMODULE_mail_alter(&$message) {
 $user = user_load_by_mail($message['to']);
 $roles = array('administrator');
 $check = array_intersect($roles, array_values($user->roles));
 if (empty($check)) {
    if (isset($user->field_home_email['und']['0']['value'])) {
      $additional_emails = ','.$user->field_home_email['und']['0']['value'];
  if (isset($user->field_email_for_text_messages['und']['0']['value'])) {
    $additional_emails .= ','.$user->field_email_for_text_messages['und']['0']['value'];
   $message['to'] = $message['to'].$additional_emails;

with multiple_email in D6

function MYMODULE_mail_alter(&$message) {
  if ($message['id'] != 'multiple_email_confirmation') {
    $user_info = array('mail' => $message['to']);
    $loaded = user_load($user_info);
    if (isset($loaded->uid) && $loaded->uid) {
      $to = multiple_email_load_addresses(1);
      foreach($to as $mail_add) {
        if (isset($mail_add->confirmed) && $mail_add->confirmed && ($mail->primary_address == 0)){
          $message['to'] .= ", " . $mail_add->email;

there is a module available. drupal 6 version is stable and d7 dev is also working for me you can try that http://drupal.org/project/multiple_email

  • If you associate a second email via this, though, does site email also get sent there? Or only to the Primary? – aendrew Aug 30 '12 at 22:03
  • i am afraid mail will sent to only primary, but not sure , please check by installing module – Serjas Aug 31 '12 at 5:28
  • That technically answers the first element -- "How do you get multiple email addresses on one user" -- but completely misses the point of question. To then say "I'm not sure, go try it" isn't very helpful. From my experience on here, it's always better to not answer than to guess -- if I tried that and didn't read the project page thoroughly, I could have spent the better part of an hour trying to configure it before realizing it wouldn't solve my problem... – aendrew Sep 3 '12 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.