Airmail iOS to DevonThink

I am not stuck in front of my computer all day. In fact half the time I take my iPad with me and try and try and do as much as I can in iOS. I have struggled until recently to find a way in which to file emails into DevonThink-to-go (DTTG). However, in the latest release of DTTG to 2.1.3 the URL scheme has received a massive up-date including the ability to generate HTML documents and PDF documents (the later through Base 64 encoding). By creating a custom action in Airmail it is now possible to send an HTML formatted email through to DTTG. One issue though is that in my archived emails in DevonThink I like to have a link back to the original email and the senders details. The following URL scheme, triggered as a custom action in AirMail, will do just that.

  
x-devonthink://x-callback-url/createhtml?title=[message_subject]&source=%3Cp%3E%3Cstrong%3EFrom%3A%3C%2Fstrong%3E%20%3Ca%20href%3D%22mailto%3A[message_sender]%22%3E[message_sender_name]%3C%2Fa%3E%3Cbr%2F%3E%0A%3Cstrong%3ESubject%3A%3C%2Fstrong%3E%20[message_subject]%3Cbr%2F%3E%0A%3Cstrong%3ELink%3A%3C%2Fstrong%3E%20%3Ca%20href%3D%22[message_linkback]%22%3E[message_linkback]%3C%2Fa%3E%20%3C%2Fp%3E%0A%0A%3Cp%3E[message_html]%3C%2Fp%3E&x-success=airmail://  

The URL scheme look a little complicated but it is simply URL encoded HTML. The first portion creates an href (i.e. an HTML link), which when selected will create an email back to the sender. The second portion is the subject. The third portion is an href that links back to the original email in AirMail. The final portion is the message itself as HTML with an x-success back to AirMail. The formatted email will look something like:

From: Xanthe Squidgery
Subject: Intergalactic meeting of moon miners
Link: airmail://message?mail=kyle%40eggleton.co.nz&messageid=CDG56767GHhjgh8766hjh34qhhj

Message to all moon miners….

Written on May 10, 2017