Each recipient of a webform submission is sent an individual email. For contact forms where multiple folks are collectively responsible for ensuring the submitter is responded to [only once], having a single thread -- where Reply-all can be used -- is extremely helpful.

I believe this is how Webform used to work, including all recipients in the To: field of a single message...

Can we add an option to the "E-mail to address" to send individually or together? I will write the patch if the functionality [does not exist and] is welcome.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I'm not sure adding this as an option is a good idea, but it's not the first time it's been requested.

acombites’s picture

Yes indeed, Webform did used to work this way prior to 6.x-3.9, and my organization relied heavily on the "reply to all" capability. So I don't view this so much as a requested feature as a "please go back to the way it used to work."

hot_sauce’s picture

I too am in need of this, though my issue is for the 6x version of Webform, which i posted in a (now duplicate) issue - http://drupal.org/node/1168442
I think a patch for this would be most welcome by myself and inevitably others who discover that the functionality is no longer there.

kari.kaariainen’s picture

I'm dreaming of functionality that would allow me to just hit reply, type my customer service answer and fire away, sending bcc copies to my fellow support team members automatically and showing a nice and clean reply to the original sender etc.

While that may be utopistic, a token containing all the recipients would be of great help.

I'm doing that now manually using the template, like so:

"...This message was send to (copy these, excluding yourself, to the bcc field):
customer.help1@site.com, customer.help2@site.com, customer.help3@site.com..."

With a token I could do:
"...This message was send to (copy these, excluding yourself, to the bcc field):
%all_recipients..."

jadowd’s picture

okay... so what is the status of this... there is a need to have a group email sent out based on the selected option... but this is broken. How soon can this be fixed?

mefisto75’s picture

sub

jadowd’s picture

Hey... can we get a hook or something in there that allows people to change how this works? this is BROKEN!

Either there needs to be an option to permit all recipients to see the email, or it just needs to be set up to work that way. There are a lot of folks here that need this to support the old method, and for good reason. Can we get some dialog about this?

quicksketch’s picture

Yes, please continue the dialog. Constructive feedback about exactly how this should be added to the interface (if we add it as an option) or research that counters my privacy/spam-prevention assumptions (people don't want their e-mail shared, bulk e-mails are more likely to be flagged as spam) would help move this along. Patches are also a good thing, but right now I'm more concerned with the theoretical changes than the code.

jadowd’s picture

I agree... my client is going bonkers about this... their system is pretty broken :(

Michelle’s picture

I think adding it as an option is a good thing. If the site builder has the choice, then Webform doesn't need to concern itself with privacy / spam issues. The site builder can decide if the benefit is worth the risk. In my case, with a small club site and multiple board members needing to be in on the conversation, I would definitely use this feature.

Michelle

jeffschuler’s picture

Version: 7.x-3.9 » 7.x-3.x-dev

Theoretical implementation:

The "E-mail to address(es)" field could be dynamically expanding: click "+" to add another recipient. This would add a new form field, (actually, a new set of "Custom | Component" radios & their respective fields.)

Each address in a single instance of this field would receive its own, individual email.

All comma-separated addresses placed in a single field would receive a single multi-recipient email and see eachother as recipients.

nairb’s picture

The comma separated approach works fine and is simple enough. You could have 3 separate "Email to addresses" on the Email Settings screen. One each for "to", "cc", and "bcc". A hook and sub module would be fine if you want to keep the code separate.

While I handle most of the incoming webform mail, I have several forms that I should only be cc'd on, or should be sent to a department head and cc a couple supervisors. This way, there is no confusion who the intended recipient is and the other people see who else has received the message and can respond if appropriate. Currently, each person receives their own copy of the message and is not aware of the message being sent to other people (unless they were told in person, or add it to the message as kari suggests). This aspect of the system is not very user friendly. Shouldn't the site admin be the one to decide how messages are sent?

The spam issue is a tricky one. When do you see bulk email and privacy being a problem? If you have explained it before a link would be helpful. :)

Brian

acombites’s picture

Category: feature » bug

I'm changing this to a bug report. Webform used to work this way, and at some point it was changed, and this functionality was broken.

quicksketch’s picture

Category: bug » feature

It was changed intentionally and for privacy reasons. I realize that privacy may not be a concern for all users of Webform, but it's intentional that privacy is enforced by default. Restoring this as a feature isn't the same as it being a bug.

windmaomao’s picture

Version: 7.x-3.x-dev » 6.x-3.9

doesn't really matter why people need it to be added. Security isn't an issue if we haven't gotten anything for outsider to steal.

here's some quick fix solution.

Solution 1) at line 162 of _webform_validate_email in email.inc, disable the validation check as a start
Solution 2) split lines using explode, and check each address with current validation method
Solution 3) to go further, add an option checkbox "Multiple emails" under validation in email field form.

I'm going to test the above solutions.

Shawn DeArmond’s picture

Version: 6.x-3.9 » 7.x-3.x-dev

This should stay on 7.x-3.x-dev as it's a yet-to-be committed feature request.

acombites’s picture

There are other ways to address privacy concerns. And privacy has always been addressed be default - as it should be. But there used to be a mechanism for developers to adapt the communication method to fit our needs. And now that flexibility has been removed.

jadowd’s picture

Make this a configuration option, and be done with it.

vernond’s picture

Hmmm, seems to be quite a bit of emotion bubbling under this issue and I don't really understand why that should be.

As I understand @quicksketch, this functionality is not available by design because it creates a scenario for potential abuse - either knowingly or, more importantly, unknowingly. I happen to agree (and for the same reasons that I agree that Webform should not have a credit card number component and that the canning of Webform PHP is a good thing - features that can be abused will be abused).

The lack of user interface configuration options in this regard is not at all an insurmountable obstacle though. Take a look at this excerpt from Webform's THEMING.txt (emphasis added):

- Advanced Webform e-mail Theming: Theming the e-mail headers may also be done
by overriding the theme_webform_mail_headers() function from webform.module.
Just copy the code out of webform.module and change as necessary in your
template.php file. This allows you to customize the e-mail headers.

There is far more flexibility inherent in adding a few lines of conditional code to the template file than what can easily be coded into Webform's UI e.g.:

function yourthemename_webform_mail_headers($variables) {
  $headers = array(
    'X-Mailer' => 'Drupal Webform (PHP/' . phpversion() . ')',
  );

  // Add a BCC recipient to a specific email.
  if ($variables['email']['eid'] == '1') {
    $headers['bcc'] = 'admin@example.com';
  }

  return $headers;
}

IMHO, uploading changes to template.php is probably not too much to ask of someone responsible for maintaining a Drupal website and it seems unlikely that template.php will require updating on a daily/weekly basis anyways. I guess that's my tuppence on the matter.

PizzaMan’s picture

Following.

The integration of the feature is crucial to the module. Way too many client requests have come in for this. The inclusion of this functionality should be kept extremely simple though.

Set a Boolean value (checkbox) that toggles between either sending a single email to all targeted recipients, and default to a unique message to each recipient when not checked.

Maybe I am being obtuse, but I think the privacy concern is being handled a bit too delicately. All instances so far where I received requests for this implementation involves members of a sole organization being included on the same message. There are not very many scenarios I can think of where the user submitting the form should be included on an email with anyone else.

Maybe this is something that is restricted by domain? The only time this functionality will work is when all recipients share the same @domain.com.

quicksketch’s picture

Set a Boolean value (checkbox) that toggles between either sending a single email to all targeted recipients, and default to a unique message to each recipient when not checked.

This sounds good to me. Preferably we'd only show this checkbox if a comma is in the address field.

quicksketch’s picture

Maybe radio buttons make sense here to clarify the difference between a single e-mail and individual ones:

Sending method:
(•) Send individual e-mails to each recipient
( ) Send a single e-mail to all recipients
Individual e-mails increases privacy by not revealing the addresses of other recipients. A single e-mail with all recipients may be preferable for groups that wish to use "Reply All" to communicate.
quicksketch’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev

Though new features are only being added to 4.x at this point, so up another version it goes.

pierrelebear’s picture

Version: 7.x-4.x-dev » 6.x-3.9

I was asked for this by a client who wants to have the same email sent to multiple people in the organization. This is so one person can respond to the customer and the internal group with a "reply to all". It would be a very useful feature.

I would suggest that when the email field has multiple emails separated by commas, one email is generated. When each recipient is one line item, individual emails are sent.

Thanks for a wonderful module!!!! Generally it works great!

Pierre
www.ventimar.com

N1029676’s picture

There really doesn't need to be anything changed from when this worked before.

If I use commas in a single entry box, that implies I want this message to go to all of those people in one message.

Different entries into that list should be treated as such.

Shawn DeArmond’s picture

Version: 6.x-3.9 » 7.x-4.x-dev

@pierrelebear: See #23.

Just to engage the discussion here, I'm just interested in seeing CC and BCC fields.

PizzaMan’s picture

Just checking in on this thread to see if anything was implemented?

I came up with a workaround a while back which utilized a setting session cookie to determine who all was to receive a single message with all recipients included, and set the value of that cookie in the mail headers via the THEME_webform_mail_headers function.

Since we had multiple groups of people depending on the category selected on the form we had to go nuts on making that send functionality happen.

And of course one month after implementation the client came back and asked that we set the form to send to a single recipient. SMH, lol...

Anyway, if anyone else is interested in the workaround, let me know and I will post it!

JoshEpic’s picture

Version: 7.x-4.x-dev » 7.x-3.9

@PizzaMan

Could you post the work around?

erykolryko’s picture

pizaman Kindly share the cookie and guide where to alter the code, so stuck my client is on my neck on that issue need to send the emails to many recepients (webform4x drupal 7).

PizzaMan’s picture

In order to make sure we were sending a single message to multiple recipients we leverage a mixture of php and javascript in a couple of places.

Here is what we will be altering:

webform-form.tpl.php
template.php

We will also be creating a php file used in setting our session variable. In our working model we've named it:

__session.php

First, let's start with our webform tpl file:

In our case we had multiple groups of form recipients depending on the nature of the submission. Within each group, we had many of the same email recipients. At first we thought to set the emails to receive each type of message within each field value of the form itself. However, this triggered a bug because some recipients were the same across different categories, and required adding extra whitespace to each identical field value. Kind of annoying. Instead we set the email values with Javascript!

Because we only have one form on the site, to keep things quick an easy we add the following script to our webform-form.tpl.php file:

<script type="text/javascript">

/********************************
This method takes the machine name values of our field and uses them to define our recipients as a comma delimited string
once we are set the value is set in a session variable with POST data using jquery.
********************************/

 function setRecipients(val){
	var _recipients;
	var target = val.toString();

	switch(target){
		case "customer_service":
		_recipients = 'email@email.com';
		break;
		case "public_relations":
		_recipients = 'email@email.com';
		break;
		case "sales_gen":
		_recipients = 'email@email.com, email2@email.com';
		break;
		case "sponsor":
		_recipients = 'email@email.com, email2@email.com,email3@email.com';
		break;
		default:
		_recipients = 'email@email.com';
	} 

        //  Be sure to set your session script path!  When in doubt, set the file to live at the root of your Drupal installation.
        //  Note that we are creating a POST data variable named "mailers".
	jQuery.post('"[path to your session script]"/__session.php', { mailers : _recipients }, function(data) { });
  }
</script>

Let's have a look at our __session.php script now that we've established where our email addresses are being set. The trick here is that we need to access our Drupal installation from a standalone script in order to set our selected email values from webform-form.tpl to a session variable. We accomplish this using drupal_bootstrap().

In your __session.php file use the following code:

<?php
//Get our Drupal installation up and running
define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']);
$base_url = 'http://'.$_SERVER['HTTP_HOST']; // THIS IS IMPORTANT
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

//Grab our POST variable "mailers" and set it to a Session variable
if(isset($_POST['mailers'])){
  $mailers = $_POST['mailers']; 
  $_SESSION['mailers'] = $_POST['mailers'];
  echo $_SESSION['mailers'];
}
?>

We now have our email recipients defined and a means for Drupal to access that data. All that is left to do is tie everything together in our template file.

First thing we want to do here is make sure our form is correctly setting email values from our select field. We need to make sure our javascript function that we defined in the webform-form.tpl is being fired. Here we are going to be utilizing the THEME_preprocess_webform_form function:

<?php
//NOTE: This block is wrapped in php tags for forum highlighting
function THEME_preprocess_webform_form(&$vars){
global $user;
//To play it safe, we begin a session when a user is anonymous
if ($user->uid == 0)
  drupal_session_start();
  	
   //change 'type_of_inquiry' to the machine name of the field you are targeting

   $vars['form']['submitted']['type_of_inquiry']['#attributes'] = array( 
	'onchange' => "setRecipients(this.value);"
   );
	
}
?>

Finally, now that we know we are setting our target email addresses properly within the session variable we can use its value when altering email headers when the message is being sent. We do this using the THEME_webform_mail_headers function in our template file as well.

In template.php use the following code:

<?php
//NOTE: This block is wrapped in php tags for forum highlighting
function THEME_webform_mail_headers(&$vars) {
  $headers = array(
    'X-Mailer' => 'Drupal Webform (PHP/' . phpversion() . ')',
  );

  //we are now sending our messages to ALL of the selected recipients defined in our webform-form.tpl file!
   $headers['to'] = $_SESSION['mailers'];
    
  return $headers;
}
?>

And there you have it! Let me know how it works out for you, or if you come up with a more simplified approach for your case.

erykolryko’s picture

Hi Pizzaman
First, many thanks for your effort in helping solve this.
Iv tried it many time i really do not know what i'm getting wrong
1. copied the first bit in to webform-form.tpl.php section between {..PASTED HERE..} , removed this word "[path to your session script]" maintained /__session.php (in root).
2.Created __session.php, pasted, made sure file permission are okay.
3. copied 3rd bit removing the php tags in to template.php
4. copied 4th bit removing php tags in to template.php below [3] function above. (replaced word "THEME" to my theme "mayo")
5. option 1-created a drop down with field name customer_service, public_relations, sales_gen, etc
option 2-created a text field with field name & form Key "customer_service"
6. Went to webform-form.tpl.php added a string of emails replacing "email@email.com"
7. In the Webform=>Email section at header. I chose component=>customer_service after testing n failing i choose component=>department (contains customer_service).
8. performance cleared cache.
9.STILL NOT SENDING EMAILS to what what i entered in webform-form.tpl.php so i can see all the recipients at a go

What im i doing wrong ?? NB {webform 7.x-4.0-alpha4, webform builder, SMTP/HTML mail}
Anybody succeeded?

PizzaMan’s picture

Do you have your webform configured to send an email upon submission?

I failed to mention that we should have our target webform set up to send an email upon submission. In our case we used a catchall address for the company domain. If I am not mistaken, the email addresses are appended to the header so that they will be displayed alongside the catchall address.

Let me know if this yields any positive results.

erykolryko’s picture

Hi Pizzaman
Yes my webform submits HTML email upon submission i use (HTML mail and SMTP). Funny enough even after making all those changes above it still submits emails as before. (to each user alone and does not show the other recipients)

All email settings are on the email section of the webform.
Also, after going through my procedure above did you detect anything wrong?
So far for me no progress, when i email each email is sent to users and does not show the other recipients.

Attempted Work Around:
I have installed "Webform reply to" module, it lists the person who i can reply the email to on the email header, unfortunately still i cant add more than one email to the list. If this works it will sort alot. Apparently the developers on the other site aint replying also.
Ooops

erykolryko’s picture

Tried many solutions until i came across this link http://drupalcode.org/sandbox/jitesh_doshi/1811566.git i downloaded the (wfdemo.info, wfdemo.module, jquery.multiselect.css, wfdemo.js ) put them in a folder called Webform demo

Installed the module NB(You have to disable Webform builder to access the BCC functionality)

It will add a BCC field (Webform 4x drupal 7) for multiple emails for the Outlook & thunderbird still testing for gmail

beardedgeek’s picture

Is there an update on the re-implementation of this feature?

Being able to "reply to all" within our company is a complete must.

beardedgeek’s picture

Anything?

swim’s picture

This solution follows a very similar concept & will overflow to multiple recipients as well, https://drupal.org/comment/6788938#comment-6788938

webform_submission_send_mail is the ticket.

Please correct me if I'm wrong but I think quicksketch doesn't want this implemented into Webform due to the fact that there are a number of ways to already achieve this functionality. Aside from the fact it's at best a fringe use case.

Cheers,

quicksketch’s picture

Issue summary: View changes

I've rethought my position since #22, in which I thought a per-form setting would be required. At this point, I think we should make sending a single e-mail to all recipients the default. However, there are 300K sites out there using the current functionality, I don't think we can switch this out from under them.

So instead, I'd like to make a site-wide setting identical to what I described in #22, but make the single e-mail option the default. For users upgrading, we'd provide an update hook to set the option to the current behavior of individual e-mails per recipient.

The big hold up here is (and has been) that just no one has written the code yet. Rather than swapping hacks and work-arounds, it'd be much more helpful if someone could submit a patch to provide this functionality directly in the module.

quicksketch’s picture

Version: 7.x-3.9 » 7.x-4.0-beta2

As with all new features, this is only going to be added to the 4.x version.

cwightrun’s picture

Has this feature been implemented into the 4.x-dev version?

webservices@tulane.edu’s picture

I've upgraded to version 7.x-4.1. Has this been implemented?

DanChadwick’s picture

Version: 7.x-4.0-beta2 » 7.x-4.x-dev

A patch along the lines of #38 would be welcome. quicksketch has thought this through, and I accept his design.

To answer the question, no, this has not been implemented as of 7.x-4.1

DanChadwick’s picture

Status: Active » Fixed
FileSize
4.65 KB

Once again, I took pity on a 4 year old feature request.

Implemented as proposed in #22 and #38. The default for existing installation will continue to be individual. New sites will send one message to all recipients. An update is required.

Committed to 7.x-4.x.

DanChadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Status: Fixed » Patch (to be ported)

  • DanChadwick committed 54389bb on 7.x-4.x
    Issue #1160400 by DanChadwick: Added multiple email recipients, one...
DanChadwick’s picture

Oooh. Forgot to delete the new variable upon uninstall. Not applicable to D8.

Committed to 7.x-4.x.

  • DanChadwick committed c71815a on 7.x-4.x
    Issue #1160400 by DanChadwick: Remove multiple/individual e-mail option...
fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Status: Patch (to be ported) » Fixed

Committed and pushed to 8.x-4.x. Thanks!

  • fenstrat committed b8153d7 on
    Issue #1160400 by DanChadwick: Added multiple email recipients, one...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Viktor-T’s picture

The Same patch adapted for Webform 7.x-3.26.

Viktor-T’s picture

fixing patch for 3.29