I'm trying to use femail with Amazon SES but a reply to a forum comment does not find its way to the original topic.

1) drupal/femail sends:
Message-ID: <0d1994f7ecea5fa0b8f48fdbde8f42b3@drupal-site>

The message is passed on to Amazon-SES, which delivers it to the user.

2) The user (in my case a gmail account) receives:
Message-ID: <0000013142921743-c310788a-d3a3-4020-86e4-e2bd81f6c87a-000000@email.amazonses.com>
In-Reply-To: <0d1994f7ecea5fa0b8f48fdbde8f42b3@drupal-site>

Notice that the Message-ID has changed. Amazon-SES put the original Message-ID in the In-Reply-To header and inserted its own Message-ID.

3) When the user replies to the email, drupal/femail receives:
In-Reply-To: <0000013142921743-c310788a-d3a3-4020-86e4-e2bd81f6c87a-000000@email.amazonses.com>
References: <0d1994f7ecea5fa0b8f48fdbde8f42b3@drupal-site>
<0000013142921743-c310788a-d3a3-4020-86e4-e2bd81f6c87a-000000@email.amazonses.com>

Result: femail fails to match the email to the comment, because it queries femail_msgs for the wrong in-reply-to (the one from amazonses).

I'm not sure who's at fault here (amazon-ses or femail), but I can see of a workaround in femail. In the final headers, the original femail Message-ID is now in the References. Therefore, femail could query for each of the references if the in-reply-to does not retrieve anything. I will probably try this, but I'm posting here for any comments.

CommentFileSizeAuthor
#1 references.patch2.75 KBalex.a

Comments

alex.a’s picture

StatusFileSize
new2.75 KB

I'm sending a patch for the 6.x-1.x branch that fixes the problem with Amazon SES. It all works now.

If there is a References header, use it in addition to the In-Reply-To. Replaced the = query for in-reply-to, with an IN query.

sdrycroft’s picture

Status: Active » Needs review

It's definitely Amazon SES that is at fault here, although it appears to be a feature of the service that they set the Message-ID header. How are you actually sending the mail messages from Drupal? Are you using the Amazon SES module? If so, it may be possible to update the Message-ID that femail records.

Thanks for the patch Alex, I'll have to add this to the 7.x branch before I can make a release.

alex.a’s picture

I am not using the Amazon SES module. I use Amazon SES system-wide, by configuring postfix.

The intent of Message-ID is not clear to me.
From RFC 822:
MESSAGE-ID / RESENT-MESSAGE-ID
This field contains a unique identifier (the local-part
address unit) which refers to THIS version of THIS message.
The uniqueness of the message identifier is guaranteed by the
host which generates it. This identifier is intended to be
machine readable and not necessarily meaningful to humans. A
message identifier pertains to exactly one instantiation of a
particular message; subsequent revisions to the message should
each receive new message identifiers.

One may think that this implies that any layer that processes the message may change the Message-ID. Amazon SES changes it, but postfix doesn't. However, postfix is on the same host as my drupal site, but Amazon SES isn't. And yet again, Amazon SES does not generate the message, my drupal site does. A message "revision" should imply a human intervention to the message (such as a reply, forward, etc).