There is a simple task that I occasionally need to perform which has caused me many headaches during the past 10 years: send an email from a server. I remember a day in my early career where I spent hours and hours trying to get Exim4 configured. I’ve similar recollections with Postfix, Sendmail and ssmtp. The last being close to what I was initially hoping for to find. But even this had it’s issues.
When the first Email-as-a-Service offerings started to arrive I was really excited. Finally something simple for a straightforward task. I used Mailgun for some projects and it worked well. Except the fact that it was another service account to be maintained.
Couple of weeks ago I had another moment where I felt the need to send an email from a server. Of course, this happened:
$ mail
zsh: command not found: mail
$ sendmail
zsh: command not found: sendmail
.. and it all came back to me. I really don’t want to spend time again on this tedious searching and reading man-pages. I rather spend time on learning something useful. Like Golang.
So I built my own sendmail. Instead of being a MTA it tries to adhere to the UNIX philosophy: make each program do one thing well. In this case: send an email via SMTP server. Golang made it possible to write this also cross-platform with zero effort. And an existing email library made the whole job a breeze.