* doc/misc/message.texi (System Mailer Setup): Add index entry.
Mention option to use emacsclient.
* etc/NEWS: Mention emacsclient option for 'mailto:' handling.
* etc/emacs-mail.desktop: Add example using emacsclient.
* lisp/gnus/message.el (message-mailto): Add optional url argument
so we can call it from emacsclient.
@node System Mailer Setup
@section System Mailer Setup
@cindex mailto:
+@cindex System Mailer
Emacs can be set up as the system mailer, so that Emacs is opened when
you click on @samp{mailto:} links in other programs.
way to set the default application for a @acronym{MIME} type, and the
relevant type here is @samp{x-scheme-handler/mailto;}.
-The application to start should be @samp{"emacs -f message-mailto %u"}.
+The application to start should be @w{@samp{emacs -f message-mailto %u}}.
This will start Emacs, and then run the @code{message-mailto}
command. It will parse the given @acronym{URL}, and set up a Message
-buffer with the given parameters.
+buffer with the given parameters. If you prefer to use emacsclient,
+use @w{@samp{emacsclient -e '(message-mailto "%u")'}} as the application.
For instance, @samp{mailto:larsi@@gnus.org?subject=This+is+a+test}
will open a Message buffer with the @samp{To:} header filled in with
Emacs can be defined as a handler for the "x-scheme-handler/mailto"
MIME type with the following command: "emacs -f message-mailto %u".
An "emacs-mail.desktop" file has been included, suitable for
-installing in desktop directories like "/usr/share/applications".
+installing in desktop directories like "/usr/share/applications" or
+"~/.local/share/applications".
Clicking on a 'mailto:' link in other applications will then open
Emacs with headers filled out according to the link, e.g.
-"mailto:larsi@gnus.org?subject=This+is+a+test".
+"mailto:larsi@gnus.org?subject=This+is+a+test". If you prefer
+emacsclient, use "emacsclient -e '(message-mailto "%u")'"
---
*** Change to default value of 'message-draft-headers' user option.
Categories=Network;Email;
Comment=GNU Emacs is an extensible, customizable text editor - and more
Exec=emacs -f message-mailto %u
+# If you prefer to use emacsclient, use this instead
+#Exec=emacsclient -e '(message-mailto "%u")'
Icon=emacs
Name=Emacs (Mail)
MimeType=x-scheme-handler/mailto;
retval))
;;;###autoload
-(defun message-mailto ()
+(defun message-mailto (&optional url)
"Command to parse command line mailto: links.
This is meant to be used for MIME handlers: Setting the handler
for \"x-scheme-handler/mailto;\" to \"emacs -f message-mailto %u\"
-will then start up Emacs ready to compose mail."
+will then start up Emacs ready to compose mail. For emacsclient use
+ emacsclient -e '(message-mailto \"%u\")'"
(interactive)
;; <a href="mailto:someone@example.com?subject=This%20is%20the%20subject&cc=someone_else@example.com&body=This%20is%20the%20body">Send email</a>
(message-mail)
- (message-mailto-1 (pop command-line-args-left)))
+ (message-mailto-1 (or url (pop command-line-args-left))))
(defun message-mailto-1 (url)
(let ((args (message-parse-mailto-url url)))