Coding & More 📱 Apps ℹ️ About
AWS S3 Serverless email
29-Jul-2021 - #aws, #email, #s3, #serverless email
While browsing my hackernews clone I came across an intriguing and at the same time bizarre project: S3 Email that will make you forget everything you thought about imap server, smtp, pop and other traditional email protocols.
According to the project description This stack was created out of frustration due to the fact that to this day there's no easy way to have a full email server without the overhead of installing and configuring all servers needed to handle incoming and outgoing messages. We wanted something simple, with no interface and no server management, so we came up with S3-Email. This included AWS SES as our email server (receive and send) and S3 as our database and interface. Then we tied everything together with a bit of code via AWS Lambda. The result is an unmanaged email server with unlimited email addresses that also offers the benefit of easily organizing messages by adding the + character to the email names. The + is converted to a /, which correlates to an object path in S3.
I was intrigued. It is true that there are several solution to install a full mail server out of a docker container or even something like WildDuck Mail Server a mail server written in node.js storing the emails in mongodb but all these solution are not truly serverless.
Additionally, a node.js solution means having to deal dependencies and a lot of moving pieces.
The astute readers among you will probably object to the use of the -- mostly marketing oriented term -- serverless because, in fact, there is always a server somewhere. Yet running your own email server, no matter if the installation is made easy by docker or an installer, requires maintaing a server including security, updates etc.
I did follow the readme of S3 Email S3 Email and, after a bit of tweaking with the settings, I managed to install it.
The installation requires the stack setup and AWS SES configuration.
So with a bit of work my email was routed to an S3 encrypted bucket. Here are my initial comments:
- You have no way to know when an email was sent to you. Unless you keep refreshing S3 you won't know if you received an email. This issue can be mitigated by adding AWS (simple notification service) to the SES Actions of incoming emails like this:
Notifications is now solved but the whole setup makes it very difficult to read emails. There are various nested folders (good for organising emails but still) so you need at least 5 clicks to reach the folder where the email is stored.
Once you click on the email you can download it in .txt, .eml and .html but the reading experience is less than optimal.
According to the replies of the author to several github issues, it is used by the author mostly for receiving newsletters, signup etc and not as a real email solution. This is fine since it is experimental and clearly provided "as is". This said I don't see how a simple forward rule or filter could have not solved the signup and newsletter issues.
In summary, it is an excellent representation and what it can be done but it would require further work to be really usable e.g. a client to read the emails and an easy way to reply (at the moment you need to upload an email in .json format).
Great concept and I am sure a lot of work went to the setup which is rather complicate for AWS novices. The diagram itself can make your head spin:
But how about Amazon WorkMail ?
with just 4$ a month you can use Amazon Workmail but, in my experience, it uses an old version of exchange that messes up with iOS settings e.g. asks you to set a different code/password and would even allow a wipe from the Workmail itself. Not recommended.
Worth mentioning that much of this stack is about processing emails and attachments (as much as I can figure out) but you can save all incoming emails from SES without any lambda function but just by adding an S3 Action as described in this tutorial S3 Email. These emails will be stored in .eml format including attachments and can be opened from any email client like apple mail or thunderbird.
In summary, this solution is truly serverless and can be useful for secondary email accounts so mostly for email notifications, newsletters or just archiving purposes. If you add the notifications as per point 2 you will always be notified when a new email comes in so it makes it somehow more usable.
To browse your emails I recommend Trasmit (Mac OS X) or another S3 compatible browser. On iOS there are also some apps that allow you to navigate S3 buckets.