DIY e-mail autoresponder using getmail, sendmail, and bash.

technology.pngAfter futxing about with several free (and commercial) autoresponders for a simple task, I realized that it would be easier to just set the thing up myself.  Yes, it requires some configuring off the front end, but it also means that you’ll have massive amounts of control on the back end.

FEATURES:
Sends properly formatted multipart HTML/plain text e-mail.
Will not send to an e-mail address more than once (by design) to avoid spamming
Uses any POP3 enabled e-mail address you have.
FREE.

YOU NEED:
getmail (properly configured – here are example configuration files)
sendmail (properly configured – you may wish to rate limit your outgoing mail)
An e-mail account with POP3 access and SMTP access.
A computer that’s (nearly) always on and connected to the internet

Look, if you don’t know how to use getmail and sendmail – or are unwilling to put in the work – you probably would be better off hiring someone.  Seriously.

So I set up this bash script as a once-every-half-hour job that pulls down ALL e-mail from a dedicated e-mail address.   (It should be pretty evident that you could, with the addition of a CASE statement, be able to parse e-mails by Subject or the body text…)

It’s pretty easy  to make the multipart message as well (and that’s why you need to use bare sendmail, by the way).  Easiest way to do it?  Compose it in something like Gmail using the rich interface and pull down the e-mail you sent to yourself.  That way you’ll understand what you’re doing.

And yes, of course someone could use this for ill.  Just like they could use a regular e-mail client for ill, or a “vacation message” or anything like that.  In fact, this setup is more secure than a vacation message, because it simply will refuse to continue an e-mail loop. And it’s something that you could actually set up to deliver anything – including the files itself – using the method shown here.

You can find the shell script below or at https://gist.github.com/uriel1998/6023127; if you can improve it, please feel free to fork it from there.