Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

To run the default web browser or terminal there are commands like x-www-browser and x-terminal-emulator. There are other alternatives for common programs.

Is there a similar command to run the default email client?

As an alternative, is there a way to execute the mailto protocol handler?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You can open the default email client, but with a new message window open with this commands:

xdg-email

or

xdg-open mailto://

Both support some options to compose the new message or a standard mailto url. xdg-email also supports attachments, cc and bcc fields.

gnome-open mailto://

Will also work, but it's only supported under gnome.

share|improve this answer
    
So there is no way to open just the client and not a new message window as well? –  Mat Feb 6 '12 at 17:54
    
Not that I know. You can check the xdg-email source, it's a bash script. It basically finds the .desktop file associated with "x-scheme-handler/mailto", and from it extracts the binary. –  Javier Rivera Feb 6 '12 at 18:38
    
Not looking likely unless I rewrite it. It also seems the solution differs depending on the distro... But I haven't looked in too much detail as it can't do what I want. Opening with the message window is sufficient (though not ideal) so unless there is a miracle solution this would seem to be the answer. –  Mat Feb 6 '12 at 19:05
    
xdg-open is a standard, and at least it works in Ubuntu, Arch and Fedora. I believe that it will likely work in most distributions. –  Javier Rivera Feb 7 '12 at 7:46
1  
In any event, xdg-email is the best way to go. Thanks for the answer. –  Mat Feb 7 '12 at 15:56
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.