If you are working on IT solutions in this day and age, there is a big chance you will get to use at least some of Amazon's AWS services. They are best known for their elastic compute cloud (EC2) and simple storage service (S3), but they offer more than 30 other services, from email, notifications, queues, archiving, machine learning and various databases.
Their simple email service (SES) is one of the most battle tested and cost effective solutions for sending email messages out there. To me, the most important feature is that they offer bounce and complaint parsing and notifications, that you can, through their another service (SNS) connect back to your app.
SES doesn't allow creation of emails with attachments directly through their API. In case of an attachment, you needed to generate raw email payload on your end.
This looses a lot of benefits of an API, because you are back to various arcane encodings, mime parts and similar problems. If you live in a country that needs more than 127 bits to represent their letters, you usually search for a very solid email composition library at this point. And even that can get problematic results in some (again arcane/legacy/local) email (web)clients.
Luckily Go has a very solid email composition library (gomail), and I already integrated it in Rye a while ago so Rye could sent emails through regular SMTP servers. Now I've started integrating AWS's official Go library, first step is SES, next will be SNS.
Below, you can see example where we use gomail and SES, to send raw email with a PDF attachment, and the resulting email.
Here is a similar example in Python for comparison (link):
Rye code is going through a little of reorg right now. More external bindings, like AWS for example, will get their own folder (contrib) and this will also be it's own github repository. Anyway .. follow us on Github.
Komentarji
Objavite komentar