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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra created an issue. See original summary.

pcambra’s picture

pcambra’s picture

Status: Active » Needs review
pcambra’s picture

Title: {Your title should be descriptive and concise} » Reply-To is ignored when both emails are in the same domain
Issue tags: -Reply-To is ignored when both emails are in the same domain
Liam Morland’s picture

Category: Task » Bug report
grossmann’s picture

Status: Needs review » Reviewed & tested by the community

I had the same issue and the patch fixed it.
So RTBC.

Liam Morland’s picture

It would be great for someone to write a test for this patch, that is, a test that fails without this patch.

  • Liam Morland committed 69d2370 on 7.x-4.x authored by pcambra
    Issue #2892494 by pcambra, Liam Morland: Follow Reply-To setting even...
Liam Morland’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch.

Adding automated testing is not trivial since there are currently no email-related tests.

Status: Fixed » Closed (fixed)

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