Is there a way to make it appear the email is coming from the person who submitted it, instead of the site it resides on? The webform has an email field, and I'd like to use that as the source of the email.


Depending on the Webform version, you can accomplish this in one of two ways:

Webform 2

When you edit the webform, look under Webform mail settings for E-mail from address. As long as you have an email field attached to the webform, you can select that field under the Component option.

Webform 3

Click on the E-mails task underneath the Webform tab when viewing a webform node. Within the E-mail header details fieldset, you'll see an option to change the E-mail from address.

Webform 3 settings

The one caveat: Drupal sets the Sender:, Errors-To:, and Return-Path: headers to the site's email address. You can, however, change these headers using hook_mail_alter().

If you wanted to make sure the email field is set to user's email address (for a logged in user), you should've noticed the User email as default checkbox in the email field's settings, which will accomplish this and will work with the setting I mentioned above.

| improve this answer | |
  • This looks like exactly what I need, but I can't find "E-mail from address" in either site configuration -> webform settings or in the webform settings on my webform content node. – Joren Jun 18 '11 at 0:52
  • @Joren If you're not seeing it, it sounds like you're using Webform 3 which included a complete reorganization of settings. I didn't realize Webform 3 was released for Drupal 6; I've added info on how to do it there, too. – user7 Jun 18 '11 at 1:20
  • Ok I found the sections. My only problem now is my email field is not showing up in the Component drop down. In fact, only one of my fields is showing up in that drop down. Any idea why? – Joren Jun 20 '11 at 21:14
  • @Joren as long as it's an email field, it should show up: i.imgur.com/2Jauq.png Are they a textfield or something? – user7 Jun 20 '11 at 21:23
  • Ah, silly. I didn't set up this form and didn't think to even check if they made the email field an...email field. Thanks. – Joren Jun 20 '11 at 21:36

According to this code: http://api.lullabot.com/webform_submission_send_mail

There is no way.

But you can send an e-mail in a hook: http://api.freestylesystems.co.uk/api/drupal/contributions--webform--webform_hooks.php/function/hook_webform_submission_insert/6

In this hook you just load e-mails you want to send this webform. You can gather sender e-mail from $node argument of this hook.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.