Hacker News new | ask | show | jobs
by beefsack 4730 days ago
I just recently decided that I wanted an in-house solution to inbound email handling (the user can send emails into the server containing commands to run) as I didn't like the expense or having to rely on an external service to do it for me. In the space of about half a day I had a working test bed:

* Vanilla Postfix

* A user with a .forward file, calling curl to post the email to my receiver route on my app

* A receiver in my Go app using the inbuilt mail package

* Logic to recursively parse multipart emails to extract plain text where possible, or strip tags from HTML when there is no text/plain version

I've been amazed at the performance and the reliability of it even in staging. It automatically emails back a confirmation of the commands and the confirmation comes back lightning quick, back through the Postfix server.

Anyone considering creating their own inbound email handler shouldn't be scared to have a crack, I was amazed at how simple and rewarding it was.

1 comments

Rather you than me... I set something up using mailgun which has been brilliant, both on the receiving and sending side. For small scale use cases like this it's free too. I send pictures of receipts from my phone to a special email and mailgun POSTs to a tiny Heroku webapp which parses the subject line for amount, currency and date and puts into out accounting software.

You get all sorts of goodies like nice attachment handling and automatic stripping out of quoted text which aren't exactly hard but fiddly.