Problem setting Mailspring as default mail client on KDE/Ubuntu 20.10

I’ve installed Mailspring on my Kubuntu 20.10 system and finding it a really nice client. However, I’ve encountered one problem.

  • If I set Mailspring as the default mail client on the system (via KDE System Settings), I get an error when clicking links in my browser (Brave): Unable to create io-slave. klauncher said: Unknown protocol 'mailto'.and Mailspring doesn’t pick up the click to compose an email.
  • If I revert the default mail client to KMail (make change in System Settings and hit Apply) then I can use mailto links as expected.
  • If I reset to Mailspring (again, in System Settings and hit Apply), I get the same error.
  • If I use xdg-open 'mailto:foo@example.com' at the terminal then I get the same error (but not in a popup dialog, obviously).

Does anyone know what’s wrong here?

When I have KMail set as the default client, I have the following lines in my ~/.config/mimeapps.list:

[Added Associations]...
x-scheme-handler/mailto=org.kde.kmail2.desktop;mailspring.desktop;thunderbird.desktop;
...
[Default Applications]...
x-scheme-handler/mailto=org.kde.kmail2.desktop;

When I have Mailspring set, I have the following lines in the same file:

x-scheme-handler/mailto=mailspring.desktop;org.kde.kmail2.desktop;thunderbird.desktop;
...
x-scheme-handler/mailto=mailspring.desktop;

I want to add that I can’t reproduce this issue on Ubuntu 20.04. It might be something with 20.10 only, or KDE.

Yes, it’s different between KDE Plasma and Gnome Shell (which Ubuntu uses). Not least, Gnome doesn’t use klauncher. :confused:

I can’t reproduce it with KDE under Ubuntu 21.04 either.

Odd. I usually use the Brave browser, and get the reported error above (after it asks permission to use xdg-open). I just tried with Firefox and it just fails silently: Mailspring becomes the focused application, but no email is created.

Could you share what you’re using in KDE Settings > Default applications to launch mailspring?

Thanks!

I’ve managed to fix this after much reading and various fiddlings about. I’m not sure what the problem was but I think what fixed it was to edit the file ~/.local/share/applications/mailspring.desktop so that the first two lines read:

Exec=mailspring %u
MimeType=application/x-xdg-protocol-mailto;x-scheme-handler/mailto;

The changes here are to add %u at the end of the first line, and to add application/x-xdg-protocol-mailto; to the MimeType declaration.