Amazon SES now supports non-verified addresses in Reply-To headers. See the official documentation, http://docs.amazonwebservices.com/ses/latest/APIReference/ and the AWS developer forums thread, https://forums.aws.amazon.com/thread.jspa?threadID=60093&tstart=0 .
However, the Return-Path header must still use a verified address.
amazon_ses.mail.inc uses the 'Reply-To' header in a message to set the Return-Path in the function amazon_ses_send_messageg():
$opt['ReturnPath'] = $source;
if (isset($message['headers']['Reply-To']) && !empty($message['headers']['Reply-To'])) {
if (strpos($message['headers']['Reply-To'], '<')) {
$opt['ReturnPath'] = preg_replace('/>.*/', '', preg_replace('/.*</', '', $message['headers']['Reply-To']));
}
else {
$opt['ReturnPath'] = $message['headers']['Reply-To'];
}
}
So if you are setting an arbitrary, non-verified Reply-To address, the messages will fail, with an incorrect watchdog error that the 'From' address is not verified.
I created this patch to properly add the Reply-To headers to the SES message. In the function amazon_ses_send_message() :
$opt['ReturnPath'] = $source;
// Reply-to headers
if (isset($message['headers']['Reply-To']) && !empty($message['headers']['Reply-To'])) {
$reply_to_members = split(",", $message['headers']['Reply-To']);
$n = 1;
foreach ($reply_to_members as $member) {
if (strpos($member, '<')) {
$opt['ReplyToAddresses.member.' . $n] = preg_replace('/>.*/', '', preg_replace('/.*</', '', $member));
}
else {
$opt['ReplyToAddresses.member.' . $n] = $member;
}
$n++;
}
}
I am attaching a patch also, I am not sure I did it correctly. I am sure the code could be better, but this worked.
This appears to be a problem in the amazon_ses-7.x-1.0-beta2.zip release also, but I don't have a system to test on.
I'm sorry I don't know enough about SES to hunt down putting the correct error message into watchdog.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | amazon_ses.mail_.inc_.patch | 991 bytes | r.aubin |
| #3 | amazon_ses-1153160-3-replytoheader.patch | 1.39 KB | mark trapp |
| amazon_ses_mail_replyto.patch | 997 bytes | calebtr |
Comments
Comment #1
calebtr commentedwhoops, called split() instead of explode()
Comment #2
geerlingguy commentedSubscribe.
Comment #3
mark trappPatch wasn't applying, so I re-rolled it, cleaned up a couple of coding standards issues, and replaced
split()withexplode()to fix theE_DEPRECATEDissue.This is a problem in all versions, so it should probably go into the latest version and be backported to 6.x.
Comment #4
thebuckst0p commentedBefore I saw this, I posted a semi-duplicate patch for this and the From Name bug at http://drupal.org/node/1133912#comment-4780196
Comment #5
r.aubin commentedIt appears that this problem causes a conflict with the Forward module http://drupal.org/project/forward (6.x version) because Forward sets the Reply-To to the user sending the email, not Drupal's sending address. If anyone has already created a version of this patch for 6.x, please post.
Comment #6
r.aubin commentedHere is a patch for the amazon_ses.mail.inc file which corrects the Reply-To problem in this thread. This patch is for the 6.x version of the Amazon SES module.
Comment #7
tkuldeep17 commentedThis version is not supported now.