blueimp / aws-smtp-relay

SMTP server to relay emails via Amazon SES or Amazon Pinpoint using IAM roles.
MIT License
76 stars 34 forks source link

Weird unverified mail address situation with SES #18

Closed pcolmer closed 3 years ago

pcolmer commented 3 years ago

I'm using aws-smtp-relay in conjunction with postfix on Ubuntu 20.04. I'm testing some new software on the server but I'm seeing a strange issue where SES is rejecting the recipient address for some reason.

Here is a log entry where SES has worked:

{"Time":"2021-08-16T13:26:47.911565572Z","IP":"172.19.0.1","From":"test-bounces+philip.colmer=linaro.org@mm3.lavasoftware.org","To":["philip.colmer@linaro.org"],"Error":null}

and here is one where it has failed:

{"Time":"2021-08-16T13:56:35.70184176Z","IP":"172.19.0.1","From":"test-bounces+philip.colmer=linaro.org@mm3.lavasoftware.org","To":["philip.colmer@linaro.org"],"Error":"MessageRejected: Email address is not verified. The following identities failed the check in region US-EAST-1: Philip Colmer \u003cphilip.colmer@linaro.org\u003e\n\tstatus code: 400, request id: 0493b463-c13b-4cb9-a101-75496abac277"}

It seems as if the mail system is trying to send the email to "Philip Colmer \u003cphilip.colmer@linaro.org\u003e" rather than just "philip.colmer@linaro.org", even though the SES log shows the latter, as does postfix:

-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
86452BFFD7     4070 Mon Aug 16 13:56:35  test-bounces+philip.colmer=linaro.org@mm3.lavasoftware.org
(host 127.0.0.1[127.0.0.1] said: 451 4.3.5 Unable to process mail (in reply to end of DATA command))
                                         philip.colmer@linaro.org

\u003c is < and \u003e is >, so something seems to be mis-parsing the text but I don't understand how or where.

pcolmer commented 3 years ago

Closing this as it appears to be an issue with the SES SendRawEmail API. The problem is that, despite specifying the sender and the recipient as part of the API call, the API is still parsing the passed raw message for further headers and then rejecting the message because of the From and To fields found there.

blueimp commented 2 years ago

Thanks for following up on this @pcolmer ! ☺️