3 ms·
I do something similar to OP [0] - and currently forward to another provider (single address, but that's only the 'envelope' To; so it doesn't matter, I preserv
by OJFord 6y ago
I do something similar to OP [0] - and currently forward to another provider (single address, but that's only the 'envelope' To; so it doesn't matter, I preserve the original whatever.to.address).
That's mostly an artefact of transitioning from that provider to my own on AWS, but I stopped working on it for some time and never continued. My plan was/still is to write a client that can read 'Just a Bunch of .Eml' format, and then I can point that at S3 (or via S3FS or whatever). Everything that exists for mailbox, maildir, and what-have-you assumes you need it to act as an MTA (I think that's right) and do the actual receiving too; and is difficult/impossible to stop that and say 'no, here's a directory full of email, just be a reader'.
Longer-term plan/idle thought is to have a JMAP server on Lambda. (IMAP isn't possible, because it has to look like/be HTTP to reach the Lambda.)
[0] - https://github.com/OJFord/amail https://github.com/OJFord/amail
- kureikain 6y agoYes, I used something like that as well. But, are you sure you can set "From" header to anything(even for email/domain that aren't verified with SES). So that on receiver side(gmail for example) it will show the original sender. In my account(in production mode, not being sandbox), I couldn't. When I attempted to set "From" header(or "Return-Path") I got these error 554 Message rejected: Email address is not verified. The following identities failed the check in region US-WEST-2: can-we-overwrite-this@my-domain.com, Test random <raindom@gmail.com>... On their example doc, using SMTP credential, they also mention this: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/examples-send-using-smtp.html https://docs.aws.amazon.com/ses/latest/DeveloperGuide/exampl...
- OJFord 6y agoNo, you can't set it to anything, you'll fail DKIM/DMARC/SPF. Just leave it as it is! You just wrap the original email in an 'envelope' with envelope-to (you @ other provider) and envelope-from (whatever @ verified with SES). You can see this here, if it helps at all, though it's a bit DSL-y: https://github.com/OJFord/amail/blob/c602f4d36c1bb9df4da1744c6b2b4f78718613d0/lambda-smtp-relay/handler.rs#L92-L96 https://github.com/OJFord/amail/blob/c602f4d36c1bb9df4da1744...
- kureikain 6y agoBy envelope-from (whatever @ verified with SES), do you mean the `MAIL FROM` command in SMTP protocol or do you mean the `header FROM` in the email header? I don't know how `send_raw` work under the hood in Rust, but without a way to set `from` header. how do recipient(say an @gmail.com) address show the original from too? Did I miss something here? It would be great if somehow the email is forward as it's in so it appear in my inbox and all the information(header) is retain. > just wrap the original email in an 'envelope' It would be great if you can help clear my mind on how to do that. Say I got an email as this: FROM: original-from DKIM: dkim sign Return-Path: etc Other header: Body of email appear here How can I use AWS SES to forward that email as-is to my @gmail.com account for example while still keep in the original header intact(so DKIM/DMARC still work. SPF will be break but it's fine for me)
- OJFord 6y agoYes, I had to check that, but MAIL FROM & RCPT TO are the 'envelope' addresses. > It would be great if somehow the email is forward as it's in so it appear in my inbox and all the information(header) is retain. Yup that's exactly it. In the client reader it looks exactly the same as if it'd been sent there directly, rather than to SES and relayed on. (If you dig into the headers it's all there of course, but just from a 'consumer' perspective it all looks normal viewing the email.)
- kureikain 6y agoThat's really weird though. I'm really curious to see how did you made it work because I want to make it works too. As I understand, an mail client, like gmail.com web UI, use FROM header to show who send this email(not the MAIL FROM, which apparently is envelop FROM address). So my questions: without ability to changing the FROM header in email, how can your mail client display original sender? because the original sender is outside of your domain. So I have a domain: `acme.com`. Someone, let's say from OJFord@gmail.com send an email to `acme.com`. And I want it to forward to kureikain@gmail.com using AWS SES? But obviously, and I can confirm by trying `smtp.send_raw`, I can only set "FROM: "header to a verified address. But in my case, the "From" is "OJford@gmail.com"... Also, I think MAIL FROM/RCPT TO(Envelop header) rarely being used to show on a mail client. They work at a higher level, mostly for routing purpose. https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-concepts-email-format.html https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-e... I really hope to make it works. So anyone can send email to my domain, and I can retain their original FROM. like the example above.