Skip to content

Instantly share code, notes, and snippets.

Created Oct 13, 2014
What would you like to do?


These scripts and glue accept email sent to a secret address and convert the body of the email into a file where the subject of the email becomes an org-mode headline with the body of the note as the body of that org-mode item. Using a custom FILE todo keyword, these items are included in the org-agenda (assuming that ~/mail/ is included on your agenda.) With a deadline of "today," relative to receipt of the email.

There are a few dependencies and assumptions. They are:

  • That you have procmail, mimencode and html2text installed on your machines and that you're using procmail to filter your email prior to it's delivery in your email

  • I've commented this out, but I run an xmpp-notify script that sends me an XMPP message whenever one of these notes arrives, just as a check.

File (excerpt:) ~/.procmailrc:

 ## Change html email to text
 * ^Content-Type: text/html;
  | `which html2text`
  | `which formail` -i "Content-Type: text/plain; charset=us-ascii"
  LOG="HTML message found and converted..."

 ## notes filtering

 * ^TO_.*[SECRET-EMAIL@example\.com.*
   # :0 hc
   # | /opt/xmpp-notify "<org-mode.mail> $SUBJECT"

   :0 fwh
   |  /opt/org-inbox subject "$SUBJECT"
   :0 fwb
   | /opt/org-inbox body 


File: /opt/org-inbox:


 touch ~/mail/

 if [ "$1" = "body" ]; then 
     html2text | mimencode -u | sed -re '/^-- /,$ d
                                    /\=20$/ d'  >> ~/mail/
 elif [ "$1" = "subject" ]; then
     echo \* FILE $BODY >> ~/mail/    
     echo "DEADLINE: <`date \"+%Y-%m-%d %a\"`>" >> ~/mail/
    echo failure
    LOG="improper command" 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment