forked from fmarier/user-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remember-mail
executable file
·28 lines (25 loc) · 914 Bytes
/
remember-mail
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w
#
# Helper for mutt to remember mails in Emacs' Org mode
#
# Copyright: © 2009-2010 Stefano Zacchiroli <[email protected]>
# 2012 Francois Marier <[email protected]>
#
# Taken from:
# http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/remember-mail
#
# License: GNU General Public License (GPL), version 3 or above
#
# Example of mutt macro to invoke this hitting ESC-R (to be put in ~/.muttrc):
# macro index \eR "|~/bin/remember-mail\n"
use strict;
use Mail::Internet;
use URI::Escape;
my $msg = Mail::Internet->new(\*STDIN);
$msg->head->get('message-id') =~ /^<(.*)>$/;
my $mid = $1;
my $subject = $msg->head->get('subject') || "";
my $from = $msg->head->get('from') || "";
chomp ($subject, $from);
my $note_body = uri_escape(" Subject: $subject\n From: $from");
exec "emacsclient", "-t", "org-protocol:/remember:/m/mutt:$mid/mail/$note_body";