If you want to use hook_mail_alter to modify a confirmation email sent by webform, your somemodule_mail_alter function won't be able to determine which webform was filled out for a given email; all it can determine is that the id is "webform_submission", which is the same for all webform emails. (I suppose you could play games with the subject or to email address, but that's not very sustainable or clean.) So can we please add a node id parameter in the drupal_mail call? The following patch should do just that.

Comments

shaisachs’s picture

Title: Please add node id to params in drupal_mail » Please add node id and sid to params in drupal_mail
StatusFileSize
new1.43 KB

Don't know why I didn't think of this before, but having the sid in the params array would also be great. Here's a patch for that.

quicksketch’s picture

Version: 6.x-2.9 »
Status: Needs review » Fixed
StatusFileSize
new1.04 KB

Since it's relatively cheap in PHP to pass large objects around, I've taken your suggestion and done one step further, actually passing the entire node and submission variables to drupal_mail(). However because I'm trying to deprecate 2.x as quickly as possible, I've only made this change to the 3.x branch. It's quite stable if you're interested in testing it, otherwise I'd update your code to use 'node' and 'submission' instead and work with your patched version until you're able to upgrade.

Status: Fixed » Closed (fixed)

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