can I get default email client in command line?

Donatas G. dgvirtual at akl.lt
Tue Nov 24 11:59:40 UTC 2009


I am trying to write a Dolphin service menu that would allow to attach a file 
to an email, but with a twist: I want the service menu to be universal enough 
to guess which email program the user is using.

For that I need to find out how to get the name of the default email program 
via shell. 

Any ideas? Is there any dbus call I could make?

If it were just kmail, the desktop file contents would look like this: 


[Desktop Entry]
Actions=attachToEmail;
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;
ExcludeServiceTypes=application/x-iso,kdedevice/*,inode/directory;
X-KDE-Priority=TopLevel


[Desktop Action attachToEmail]
Exec=kmail -s "Attached $(for i in %F; do echo $(basename $i); done)" --attach 
%F
Exec[lt]=kmail -s "Prikabinu $(for i in %F; do echo $(basename $i); done)" --
attach %F
Name=Send by email...
Name[lt]=Siųsti e. paštu...
Icon=kmail

Note that Exec lines are cut it two lines. Also note, that it is cool that 
Exec lines can actually be localized!

If it were just the thunderbird, it would go like this: 

[Desktop Entry]
ServiceTypes=KonqPopupMenu/Plugin,all/all,all/allfiles
Type=Service
Actions=attach;
X-KDE-Priority=TopLevel

[Desktop Action attach]
Name=Send using Thunderbird
Name[lt]=Siųsti e.paštu
Icon=mail-attachment
## only for single files, the examples below for multiple files did not work:
Exec=thunderbird -compose $(echo attachment=file://%F)
#Exec=thunderbird -compose `echo attachment=\'file://%F\' | sed 's/ \//,file:
\/\/\//g'`
#Exec=thunderbird -compose `echo attachment=file://%F | sed 's/ \//,file:
\/\/\//g'`



If I could get the default email program by executing some program in command 
line I could proceed...

Donatas




More information about the kubuntu-users mailing list