Amazon SES rewrites the “Message-IDs” of emails sent through it. This breaks one of Discourse’s security features related to incoming email.
To make it work, you can disable the “find related post with key” site setting, but be aware that it does open up the potential for users to be impersonated by email.
I think it might actually be possible to actually fix the SES problem.
SES rewrites the message IDs, which is annoying, but it gives the client the new message id in the SMTP transaction. So if we can get hold of that at the point of sending the email then swapping some stuff around here might solve the problem:
A slightly crude experiment I did was to set return_response: true in the Rails SMTP settings, then adjust the code above to
begin
val = @message.deliver_now!
Rails.logger.error("SMTP says #{val.message}")
rescue *SMTP_CLIENT_ERRORS => e
return skip(e.message)
end
And then in my logs I get
SMTP says 250 Ok 0102015e11ccfcb7-23e96y80-9c33-4cfd-baba-1555c5a26f38-000000
which is the actual message ID that SES is using.
Needs more investigation - who knows what else I’ve broken by changing those things - but it’s an idea.
None of the destination email addresses are recognized, or the Message-ID header in the email has been modified. Please make sure that you are sending to the correct email address provided by staff.