Mailserver
For this project, I decided to implement a fully serverless email service. AWS provides the core component, Simple Email Service (SES). SES handles communication with external email services, but does nothing else. I used S3 for storage of received emails. I went with ssmtp for email sending since it was easy to set up and well documented, but I plan to implement a more fully featured solution using AWS APIs in the future. I used Step Functions to orchestrate runtime changes to the server.
The motivation for this project was to be able to supply arbitrarily named email addresses to AWS to represent different identities within my organization. I or a delegated administrator would be the owner of these identities, so it was not necessary that access to the emails received be individuated. Further, a clean user interface was not a priority since the volume of email would be very low. As such, my design prioritizes simplicity and cost efficacy. It is shockingly cheap to run, ranging in the fractions of pennies per month. (Compare that to the $4 per user per month charged by AWS' fully managed email server, WorkMail.)
The basic data flow looks like this: When an external service sends an email to an email address at the configured domain, SES first matches the address against a list of configured rules. If a rule matches, SES performs the configured action. In most cases, the email is forwarded to a configured S3 bucket. A notification is also published to a channel to which server users are subscribed. Users then pull the email from the bucket, and view it locally. To send a reply, they use configured credentials to authenticate to SES as a registered user of the mailserver.