email-to-hugo - Update your Hugo blog via email

My most productive period of blogging here was when I used the late lamented Posterous. That was due to its blogging-by-email feature. Whilst a similar feature is available for hosted blogs like WordPress, things are a lot more difficult if you have a static blog. 

That Posterous blog (e.g. this one) was converted to several other systems over the years and is currently generated by Hugo

My workflow for blogging is generally to write a new markdown file, add it to the git repo, commit it along with any images and then wait until CircleCI re-generates the blog output and deploys it to S3/Cloudfront. 

Those first set of steps create a mental barrier to doing quick posts on things I find interesting. 

It’s also next to impossible on a phone without having a full Linux subsystem installed.

phone.gif

So I decided to implement the email-to-hugo tool. 

Its main features are:

  • It checks an email account via IMAP regularly and converts new emails to Hugo blogposts which it then uploads to your Hugo source GitHub repo along with any inline images.
  • It runs as a Serverless function on AWS Lambda every 15 minutes (or when you manually call its URL).
  • Overall it is likely to be very brittle and has only been tested on GMail.
  • It doesn’t handle attached images in GMail, only inline ones

  • It allows use of # ## and ### for h1, h2 and h3 in your emails

  • Basic GMail formatting like bold/italic/underline is preserved. Font and font-size are not.

  • It assumes you are building your Hugo site via some sort of CI like CircleCI. It does not runHugo in any way. So it can be used from any device with an email client.

  • There is a simple whitelisting feature so that admin/spam/accidental emails to your account don’t get converted to blogposts

Go grab it, along with the setup instructions over on the GitHub repo. As always, the code is terrible but functional.

And of course this blogpost was created via email!

Conor O'Neill

Tech guy who likes running slowly

Bandon, Cork, Ireland https://conoroneill.net