Problem/Motivation
When the from email and the reply-to email belong to the same domain, the "Use Reply-To header" setting is ignored.
For example, we have a site that has hundreds of webforms, each one sends emails from a different user, all of them use the generic address "webmaster@example.com" which authenticates in an email server.
When "john.doe@example.com" configures his webform, the emails are sent from "john.doe@example.com" and not from "webmaster@example.com" as expected when enabling the "Use Reply-To header" setting.
As we use an authenticated email server, these emails are rejected.
The part that produces this behavior is in webform.submissions.inc:
if (webform_variable_get('webform_email_replyto') &&
empty($email['headers']['Reply-To']) &&
($default_from_name = webform_variable_get('webform_default_from_name')) &&
($default_from_address = webform_variable_get('webform_default_from_address')) &&
($default_from_parts = explode('@', $default_from_address)) &&
count($default_from_parts) == 2 &&
$default_from_parts[1] &&
stripos($email['from'], '@' . $default_from_parts[1]) === FALSE) {
Specifically, stripos($email['from'], '@' . $default_from_parts[1]) === FALSE
will filter out any email addresses that share the same domain. I think if you don't use an authenticated Email server, you will never notice this.
Proposed resolution
Change the condition to only check exact email.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2892494-same-domain-reply-to-1.patch | 726 bytes | pcambra |
Comments
Comment #2
pcambraComment #3
pcambraComment #4
pcambraComment #5
Liam MorlandComment #6
grossmann CreditAttribution: grossmann commentedI had the same issue and the patch fixed it.
So RTBC.
Comment #7
Liam MorlandIt would be great for someone to write a test for this patch, that is, a test that fails without this patch.
Comment #9
Liam MorlandThanks for the patch.
Adding automated testing is not trivial since there are currently no email-related tests.