Would it be hard to have BCC option? Something similar to "CC Submission" checkbox. Thanks

Comments

gpk’s picture

You may be able to implement this pro tem using hook_mail_alter in a custom module by adding the required BCC recipients to $headers. See http://api.drupal.org/api/function/hook_mail_alter/5

seakayjay’s picture

Thank you for your reply. I got it working already.

solutionsphp’s picture

Care to share your code, ckjian? Thanks!

quicksketch’s picture

Status: Active » Closed (fixed)

As a final word on this feature request, rather than using CC or BCC at all, in the 2.x branch of webform emails are sent individually rather than as a single email. I believe this should solve the need for BCC, as a user can be sent a unique email rather than being tagged onto the single one that used to be sent.

gpk’s picture

Thanks for the update, quicksketch.

gpk.

xqi’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

hi quicksketch,

my webform allows users to choose from 3 different options. for each option, there are dedicated group of people receiving the submissions. (one option matches multiple email address) however, within the group, i really want each email recipient to receive the emails without knowing who are those other recipients.

I tried to put multiple email addresses into each option (webform 2.0), the email is sent out, but it discloses all email addresses of that option to all recipients.

For my situation, do you think i have to use a dummy email address for each option and then use mail_alter to add BCC fields to the mail header?

Any suggestions?

Thank you.

Xin

quicksketch’s picture

xqi, you can make a separate hidden field for each address you wish to receive to receive an email. Emails are now sent individually (by component) so each user will see the email as being addressed to only them.

xqi’s picture

thanks for the quick reply.

but i could not figure out how to apply condition to the hidden fields. seems all hiden fields receive emails once they are enabled.

if user select 1, then i want to send emails to email1@example1.com, email2@example1.com, email3@example1.com
if user select 2, then i want to send emails to email1@example2.com, email2@example2.com, email3@example2.com

and i want to make sure that email1@example2.com does not know email2@example1.com, email1@example1.com also received this email.

quicksketch’s picture

Ahh, hmm. You've passed where webform can do this for you "automatically". Instead you'll need to leverage the additional submission code, because this involves more logic than webform can provide out of the box.

Webform adds a variable to the node object called "additional_emails" during the submission process. By adding more emails to this property, emails will be sent out to additional people.

So something like this would send an email to another user even without a component.

$node->additional_emails['custom'] = 'user@example.com';

You can accomplish what you want with this code that checks the value of a select list, then makes a list of addresses which will receive emails. You'll need to adjust the code for your select list and email addresses of course.

switch ($form_values['submitted_tree']['select_component_id']) {
  case 'option_1':
    $node->additional_emails[] = array('user1@example.com', 'user2@example.com', 'user3@example.com');
    break;
  case 'option_2':
    $node->additional_emails[] = array('userA@example.com', 'userB@example.com', 'userC@example.com');
    break;
}
xqi’s picture

thank you quicksketch!

I added the code to additional processing and it works for me! I only need change the node->webform[additional_emails] based on the selected option. this is great and i do not need even put any email address to html page which could be picked up by the spammers.

thanks again for the great module!

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Fixed

Cool, let's close this back up as we accidentally turned this into a support request. Please open another issue for any other difficulties.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

rhlowe’s picture

> in the 2.x branch of webform emails are sent individually rather than as a single email

Is this still the case? In my testing it seems that the described behavior is not true.