Allow for an alternate 'multi recipeient' mode which allows a sender to specify multiple email addresses rather than just one.

In this mode, the send form will not contain first, last name fields but instead a single text area in which sender will enter a list of email recipients separated by a new line.

Admin will specify mode in admin/settings. Default mode will be existing single-recipient mode.

This feature has be requrested by a client of mine, and I will submit a patch when this feature is completed. Hopefully it can be integrated for use by others :)

Harry

Comments

allie micka’s picture

You should be able to do this with a form_alter.

Send will respect a form value called 'recipients' that contains a space/comma/newline-delimited list of addresses. Try something like this (not guaranteed to work)

  $form['to'] = array(); //reset the to section

  $form['to']['recipients'] = array(
    '#type'          => 'textarea',
    '#title'         => t('Recipients'),
    '#required'      => true,
    '#rows'          => 30,
    '#cols'       => 30,
  );
harry slaughter’s picture

Status: Active » Closed (fixed)

Thanks Allie,

This does indeed work.

If anyone else is interested, here's all the module code you need:

<?php
/**
 * @file
 *   Change functionality of send.module. Allow for a list of email addresses
 *   rather than just a single recipient.
 */

/**
 * Implementation of hook_help().
 */
function send_multi_recipient_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      return t('Change behavior of send.module. Allow for multiple recipients.');
  }
}

/**
 * Implementation of hook_form_alter().
 *
 * We completely change the recipient portion of the form and
 *
 */
function send_multi_recipient_form_alter($form_id, &$form) {
  // We only care about the send form
  if ( $form_id == 'send' ) {
    $form['to'] = array(); //reset the to section

    $form['to']['recipients'] = array(
      '#type'     => 'textarea',
      '#title'    => t('Recipients'),
      '#description' => t('List of email addresses separated by commas or new lines.'),
      '#required' => true,
      '#rows'     => 5,
      '#cols'     => 10,
    );
  }
}

?>

Marc Bijl’s picture

Hi Harry,

Looks promising to me! However, as I'm not a programmer, I don't fully understand what changes should be made to existing files to get this working. Tried a bit, but unfortunately with no result. Please, can you explain how I should edit?

Thanks!

harry slaughter’s picture

I suppose instructions may help :)

It's simple.

1) Create a file in your modules directory called 'send_multi_recipient.module'
2) paste the contents of the code into that file as-is. make sure you're editor doesn't do anything funky with the code
3) save/exit
4) enable the send_multi_recipient module in admin/modules

That's it.

Marc Bijl’s picture

It works pretty good, cool! However, if I use this for the tell a friend function, something strange happens with all the images that are on the page. For example, sending a page which contains 3 images:

- The 1st recipient receives a mail with images embedded in the mail
- The 2nd recipient receives a mail with images embedded in the mail, and 3 image attachments
- The 3rd recipient receives a mail with images embedded in the mail, and 6 image attachments
- The 4th recipient receives a mail with images embedded in the mail, and 9 image attachments
- et cetera

Another detail: in the message box, a separate message (confirmation) will be displayed for each person that will receive the mail.

Marc Bijl’s picture

Status: Closed (fixed) » Needs work

As the status of this issue is set to duplicate, I think it's neccessary to set the status of the issue here to "code needs work" (as the solution provided above has some drawbacks).

allie micka’s picture

Status: Needs work » Closed (fixed)

This behavior is from the Mime Mail Issue that I closed yesterday.

I backported those changes to Mime Mail 4.7, and tomorrow's version of the nightly build should reflect this.

Marc Bijl’s picture

A bit late but: thanks!

jsimonis’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

An updated version for 5.x?

I tried that code, but the module doesn't even show up on the modules page.