TidyMail

28 Jun 2012

Top-posting

The iOS Mail app is great in many ways, but it unfortunately leads you to commit one of the cardinal sins of emailing:

Specifically, when you reply to a message, Mail places the insertion point and signature above the quoted text of the message to which you’re replying. This leads you to write your reply before everything, which as all right-thinking people know is beyond the pale.

In order to solve this, I’ve come up with a script called TidyMail, which can be downloaded from the GitHub project page. This adds a signature where you want it, and performs other tidying (such as remove the signatures from quoted messages) as it goes. To use it, you turn off the signature in Mail, and instead insert the standard signature leader (a line containing only “–”) where you want the signature to be inserted. Everything below this line will be deleted, which is useful if you only want to quote the start of a message.

There is one remaining question; how do you invoke the script to tidy up outgoing messages? iOS is notably (perhaps notoriously) stringent in what it allows to run on the device, so invoking the script on the client is not an option. Fortunately, I run my own mail server, which gives me a way in. There are various possibilities, but I’ve settled on configuring my MTA, Exim, to run the script as part of its remote SMTP transport. This is easy to do by adding the following line to the “remote_smtp” section:

transport_filter = /etc/exim4/tidymail.py

This works reasonably well, but has the drawback that it won’t apply the filter to mail delivered locally. This is fine for my use, as I’m the only one using the server, but your mileage may vary. I imagine there are better ways to hook the script into Exim, but I’m not all that familiar with the package. If you have any suggestions, I’d be delighted to hear from you

There we go; it’s a slightly convoluted system, but it’s been working well for me for a couple of years. If you use iOS or a similar mail client, have your own server, and dislike top-posting, then you might find it useful too.

This site is maintained by me, Rob Hague. The opinions here are my own, and not those of my employer or anyone else. You can mail me at rob@rho.org.uk, and I'm robhague on Twitter. The site has a full-text RSS feed if you're so inclined.

Body text is set in Georgia or the nearest equivalent. Headings and other non-body text is set in Cooper Hewitt Light. The latter is © 2014 Cooper Hewitt Smithsonian Design Museum, and used under the SIL Open Font License.

All content © Rob Hague 2002-2015, except where otherwise noted.