Thursday, March 17, 2011

Enabling Drupal webform to send email to registrant

I spent a considerable amount of time trying to figure this one out. The webform I created would not send an email out to the registrant, but the test webform I created worked nicely. I finally found out that the field "email" must not belong to any fieldset. I placed "email" at the top of the list and it worked just fine.

However, in order for this to work, you also need to place the following code in the Additional Processing field under Webform Advanced Settings:

$to = $form_values['submitted_tree']['email'];
$from = "your email here";
$body = drupal_html_to_text($node->webform['confirmation']);

$message = drupal_mail('webform_extra', 'reply', $to, language_default(), array('body' => $body), $from, TRUE);

function webform_extra_mail($key, &$message, $params) {
  $message['subject'] = "your subject here";
  $message['body'] = $params['body'];

Customize $from and 'subject'

Thanks to for this fix.  Very helpful.

Here's another link from with an alternate solution.

No comments:

Related Posts Plugin for WordPress, Blogger...