1.12 System Mailer Setup

Emacs can be set up as the system mailer, so that Emacs is opened when you click on ‘mailto:’ links in other programs.

How this is done varies from system to system, but commonly there’s a way to set the default application for a MIME type, and the relevant type here is ‘x-scheme-handler/mailto;’.

The application to start should be ‘emacs -f message-mailto %u. This will start Emacs, and then run the message-mailto command. It will parse the given URL, and set up a Message buffer with the given parameters. If you prefer to use emacsclient, use ‘emacsclient -e '(message-mailto "%u")' as the application.

For instance, ‘mailto:larsi@gnus.org?subject=This+is+a+test’ will open a Message buffer with the ‘To:’ header filled in with ‘"larsi@gnus.org"’ and the ‘Subject:’ header with ‘"This is a test"’.