Hi all,
i just wanted to share some code i've written that i think others might
find useful.
To support 'mailto' links of the form:
mailto:[email protected][email protected]&Subject=Your%20message%20about%mu4e
in my browser (Iceweasel née Firefox), i've created a function:
(defun new-message-from-uri (uri)
"Create a new email message based on a 'mailto' URI and its parameters."
(let ((uri-decoded (url-unhex-string uri))
(to-address-re "mailto:\\([^?]+\\)")
(to-address "")
(has-args-re "\\(\\?\\)")
(has-args-p nil)
(args-alist '()))
(string-match to-address-re uri-decoded)
(setq to-address (match-string 1 uri-decoded))
(string-match has-args-re uri-decoded)
(setq has-args-p (match-string 1 uri-decoded))
(if has-args-p
(let ((args-re "\\([^&=]+\\)=\\([^&]+\\)"))
(while (string-match args-re uri-decoded (match-end 0))
(setq args-alist (cons `(,(match-string 1 uri-decoded) .
,(match-string 2 uri-decoded)) args-alist)))))
(if (assoc "Subject" args-alist)
(message-mail to-address (cdr (assoc "Subject" args-alist))
args-alist)
(message-mail to-address nil args-alist))))
which is called from an executable shell file "emacsmail.sh":
#!/bin/zsh
emacsclient -e "(new-message-from-uri \"$@\")"
having set that file as the 'action' for the 'mailto' content type in
Iceweasel by going to Edit -> Preferences -> Applications.
Thus, when i click on a 'mailto' link, Emacs presents me with a new
message with the To, Subject and In-Reply-To header fields filled in
appropriately.
Hope that someone else finds this useful!
Alexis.
--
You received this message because you are subscribed to the Google Groups
"mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.