aws-lambda-ses-forwarder icon indicating copy to clipboard operation
aws-lambda-ses-forwarder copied to clipboard

X-Autoreply: yes

Open dxdc opened this issue 9 years ago • 2 comments

Thank you to the creators of this script! This is a terrific script and I've been using it for over a month now. It's been working great.

One curious issue I've come across recently is due to people with 'Gmail autoreplies' set up. Seems like between Gmail and Amazon, the original user's from address is getting stripped before it is even seen by this script. This results in undesired behavior:

  1. Email is sent to Gmail user (FROM [email protected]), with auto reply configured
  2. Auto-reply sends email back to ([email protected]), however, From address is listed as [email protected].

From header reports amazonses.com (??)

From: [email protected]

To header reports the same email address as the one sent.

To: (same as sender address)

Possibly-related MIME headers:

Precedence: bulk
X-Autoreply: yes
Auto-Submitted: auto-replied

At any rate, I can think of a few ways to deal with this:

  • Look for and ignore any mail with X-Autoreply: yes header set
  • Ignore any email with FROM: [email protected]

General thoughts?

dxdc avatar Apr 17 '16 16:04 dxdc

I set up this test case and saw the same result.

It looked to me like Gmail's autoreply is sent to the email address in the Return-Path header (not From), which is generated by SES and is an address on the amazonses.com domain. Interestingly, SES seems to forward email sent to this address to the original recipient's address, which became the "sender" of the forwarded email that was sent through SES to Gmail.

Since #4, this script removes the Return-Path header from the original email, since the Return-Path header must be verified and the script assumes email is received from unverified addresses.

arithmetric avatar Apr 22 '16 18:04 arithmetric

Thanks @arithmetric! I appreciate you verifying this as well. You're right about the return-path, from some other testing, seems like typical SES return path email addresses are specific to that account, which is how they must be tracked:

e.g. 010001544acacdb0-6cad9023-e5fa-47a6-8g59-3983dd179310-000000@amazonses.com

then, it must convert the from address to FROM: [email protected].

In this case, I think we should ignore any email with X-Autoreply: yes AND FROM: [email protected]. Though it should only be the headers in the most recently sent message, not any header ever present in the message itself.

What do you think?

dxdc avatar Apr 25 '16 03:04 dxdc