I am using the webform module and mandrill module together.

Emails were being bounced by certain recipients with the error:
"smtp;550 Messages should have one or no Reply-To headers, not 2."

The issue was the webmail module was setting a reply-to attribute in the header array using the array key "Reply-to". Mandrill's module is checking for an array key "Reply-To" (Capital T in "To"). If mandrill does not find that key, it adds an array item with the key "Reply-To". This results in two array items: $header['Reply-to'] and $header['Reply-To'] and as a result two Reply-To headers in the email.

I confirmed the email specifications declare the headers case insensitive.
https://stackoverflow.com/a/6143644

Therefore this issue is drupal specific and about the interplay of different contributed modules extending one another.

I searched core and found a mix of uses of "Reply-to", "Reply-To" and "reply-to". Googling around "Reply-to:" seems most popular.

A simple fix could be to confirm to webmail's module and use the key 'Reply-to'. I will provide a patch below.

However, I may suggest a more robust solution that can handle any mixed capitalization. I will provide that patch below also.

Comments

maestrojed created an issue. See original summary.

maestrojed’s picture

The provide patch attempts to allow for any mix of capitalization in the header key "Reply-to". Different contributed modules may not be consistent in their capitalization.

This is achieved by making a mapping between all header keys and their lowercase version.

When this mandrill module adds a "Reply-to" header it will use the more popular "Reply-to" opposed to the previously "Reply-To".

maestrojed’s picture

Assigned: maestrojed » Unassigned
Status: Active » Needs review
nikathone’s picture

+1 for RTBC. Can confirm that the patch above is fixing the issue. Was having two reply to headers before applying the patch.

criz’s picture

This patch works for us. We had some bounces because of this issue.

Just fixed some typos and coding standard.

Ante890’s picture

Status: Needs review » Reviewed & tested by the community

Time to merge?

samuel.mortenson’s picture

Assigned: Unassigned » rjacobsen0
knyshuk.vova’s picture

The patch looks good and applies successfully. +1 for RTBC.

rjacobsen0’s picture

This is great! The only change I might make is to make the first letter capital in the final header array, that is, Reply-to instead of reply-to. But this is a minor point.

  • rjacobsen0 committed 7221a9f on 8.x-1.x authored by criz
    Issue #2881210 by maestrojed, criz, samuel.mortenson, nikathone,...
rjacobsen0’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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