Chromium and mailto: URLS
xdg since Issue 61942.
But getting it to work correctly seems to be hard.
There is a specification for opening URLs and files.
It is called X Desktop Group (XDG), now renamed to freedesktop.org.
You can use
xdg-open to open a file.
It will pick the right application automatically.
There also is
xdg-email to compose new emails.
xdg-email only understands a limited subset of options:
bcc(Blind Carbone Copy)
You can launch an email client yourself like this:
xdg-open 'mailto:email@example.com?subject=Subject&body=Body' xdg-email 'mailto:firstname.lastname@example.org?subject=Subject&body=Body' xdg-email --to email@example.com --subject Subject --body Body
xdg-email supports two syntaxes:
- the split out variant using multiple arguments
- or by either passing a
mailto:URL, which is passed unmodified (with one exception)
xdg-email only understands the options listed above, other options ones like
In-Reply-To might get ignored.
But this depends on your environment.
You can create a custom script named
It has the highest priority.
This is quiet useful to disable any further URL and command line processing:
Newer versions of Thunderbird seem to support URL-handling themselves:
thunderbird -h # Usage: /usr/lib/thunderbird/thunderbird [ options ... ] [URL]
You can use this to pass through other mail headers like
Create a file
xdg-email-hook.sh in a directory, which is searched by
- Make it executable
- Use the following content:
#!/bin/sh exec /usr/bin/thunderbird "$@"
You can user the environment variable
MAILER to select your preferred mail client.
It has the second highest priority.
You can configure multiple clients, separated by
They are tried in that order until one succeeds.
xdg-email will try to determine your Desktop Environments:
- it evaluates the environment variable
- it uses the environment variables
DESKTOPto detect some common environments.
- it uses
dbusto query the current session manager
It will query
You can configure Thunderbird as your default handler for email like this:
xdg-mime default /usr/share/applications/thunderbird.desktop x-scheme-handler/mailto
It will use
exo-open to launch your mail client.
With KDE you have one more indirection: You need to get the name of your profile. Then you need to get the currently configured mail client:
kreadconfig5 --file emaildefaults --group Defaults --key Profile # Standard kreadconfig5 --file emaildefaults --group PROFILE_Standard --key EmailClient # thunderbird %u
Arch Linux has a good article about this issue, too. It was the one with prompted me to write this blog.