Situation:

When sending email with Rules HTML email, the current dev SMTP module version always adds Reply-to Address used for SMTP authentication to the email.

Problem:

Multiple reply-to addresses confuse mail clients, cause the recipient to reply to multiple addresses, some of which are not desired.

Expected Behaviour:

There is some discussion going in other issues, so I will try to tackle it from broader perspective:

Scenario A

My SMTP does not allow to send mail with "From" field in other domain than SMTP itself (eg. cannot send mail from test@gmail.com from my SMTP running @visionapps.cz; I can only send from like test@visionapps.cz). I believe this to be usual scenario.

The module should handle Reply-to following way:
a) Reply-To Address in not specified and From address is different from SMTP – write From address to Reply-To, change From to SMTP. Otherwise the email will not be sent.
b) Reply-To Address in not specified and From address is the same as SMTP - do nothing
c) Reply-To Address in specified – use the specified address

Scenario B

My SMTP does allow to send mail with "From" field in other domain than SMTP itself (eg. can send mail from test@gmail.com from my SMTP running @visionapps.cz)

The module should handle Reply-to following way:
a) Reply-To Address in not specified and From address is any address – set nothing to Reply-to
b) Reply-To Address in specified – use the specified address

Hope this makes sense and will help clean the behaviour a little. I am happy to test.

Comments

david@nabru.eu created an issue. See original summary.

wundo’s picture

Status: Active » Closed (outdated)
Collins405’s picture

Just ran into this too.

We're using amazon SES, setup with SMTP module sending from "noreply@mysite.com"

I am explicitly setting the Reply-to header to a single email address

/**
 * Implements hook_mail_alter().
 */
function custom_brand_mail_alter(&$message) {
	if ($message['module'] == 'custom_brand') {
		$message['headers']['Reply-to'] = 'brands@mysite.com';
	
	}
}

However, looking at the headers in the email source, they are...

Reply-to: brands@mysite.com, noreply@mysite.com

This means any user replying is given our automatic "no reply" response. How do I remove the default secondary email?

Collins405’s picture

Status: Closed (outdated) » Active
Collins405’s picture

Status: Active » Closed (works as designed)

Actually, I found the issue.

This is due to the headers being able to be set in any case.

e.g. Reply-to and Reply-To

Changing my code to use the latter meant that it properly overrode the original, rather than appending an item to an array.

function custom_brand_mail_alter(&$message) {
	if ($message['module'] == 'custom_brand') {
		$message['headers']['Reply-To'] = 'brands@mysite.com';
	
	}
}
TR’s picture

Status: Closed (works as designed) » Closed (duplicate)

Please don't just close issues because you fixed it on YOUR site - if it's a bug, it's a bug and needs to be fixed for everyone.

This is a real bug, and the reasons for it are described in #3174406: Problem with Reply-To field. It is NOT sufficient to just say change the case of "Reply-to" because headers are DEFINED to be CASE INSENSITIVE by the RFC. So all you've done is to avoid the issue for your own personal use-case. This remains a bug with the SMTP module.

Rather than re-open a old, closed issue, please contribute to the open issue at #3174406: Problem with Reply-To field and help fix this bug.

Marking this as a duplicate so other's can find the current issue.