3 # Helper for mutt to remember mails in Emacs' Org mode
5 # Copyright: © 2009-2010 Stefano Zacchiroli <zack@upsilon.cc>
6 # License: GNU General Public License (GPL), version 3 or above
8 # Example of mutt macro to invoke this hitting ESC-R (to be put in ~/.muttrc):
9 # macro index \eR "|~/bin/remember-mail\n"
15 my $msg = Mail::Internet->new(\*STDIN);
16 $msg->head->get('message-id') =~ /^<(.*)>$/;
18 my $subject = $msg->head->get('subject') || "";
19 my $from = $msg->head->get('from') || "";
20 chomp ($subject, $from);
21 my $note_body = uri_escape(" Subject: $subject\n From: $from");
24 if (defined $ENV{DISPLAY} and length($ENV{DISPLAY})) {
29 exec "emacsclient", @EMACS_OPTS, "org-protocol://capture?template=m&url=mutt:$mid&title=mail&body=$note_body";