ElectronMail icon indicating copy to clipboard operation
ElectronMail copied to clipboard

Option to set app as default mail client

Open evangelia1 opened this issue 7 years ago • 15 comments

Hello, I am a tutanota user and I need to make your client the default client in Windows. I have a program that exports images straight to the associated default desktop mail client, so I do not need to first export the images to desktop and then to import them to the desktop client. I use win 7 pro and win 10 home. It seems I can make your app the default client. Please inform.

evangelia1 avatar Oct 28 '18 10:10 evangelia1

Same issue. I am not able to set as default app in Linux / Ubuntu / Gnome-shell

skewty avatar Jul 06 '19 15:07 skewty

According to this discussion this seems pretty easy to implement, at least on MacOS.

To open a prefilled composer on the protonmail web client you can do this

var injector = window.angular.element(document).injector()

var root = injector.get("$rootScope")
var messageModel = injector.get("messageModel")

let composeWithMessage = (message) => root.$emit("composer.new", { "type": "new", "data": {"message": message} })

let compose = (toAddress, subject, body) => {
	let message = messageModel()
	message.Subject = subject

	message.AutoSaveContacts = 0;
	message.ToList = [{ Address: toAddress, Name: toAddress }]
	message.setDecryptedBody(body)
	composeWithMessage(message)
}

compose("[email protected]", "Testsubjects wanted", "We want your dead body")

Would you be willing to give it a try? Otherwise I could also try to implement this and drop you a PR if you want to, which would probably take some time though.

heilerich avatar Aug 08 '19 12:08 heilerich

In general, the task consists of two parts:

  • First is the integration with the system complete and robust implementation of which might be tricky especially on Windows (there most likely will be a need to directly mess with a Windows Registry). So the implementation might look sophisticated and will require testing on Windows 7-8-10, Linux and macOS. This is more like a one-off task though.
  • The second part is opening a prefilled composer, ie the integration with prepackaged official web clients (like the above-shown AngularJS code snippet). This part increases the maintenance burden.

Would you be willing to give it a try?

I'm not planning to jump into the task yet.

Otherwise I could also try to implement this and drop you a PR if you want to, which would probably take some time though.

As I pointed out adding the feature will increase the maintenance burden. Any web client update could potentially break the functionality so if at least the integration with the web clients code layer will be covered by automated tests then I will accept the PR. Alternatively, if you only need this working on macOS, don't want to deal with tests, etc, you could fork the project, add the change, hook the project up with the CI system and get your own installation package as an outcome.

There also will be an in-between task - showing a list with added to the program accounts, and only having the specific account selected the opening a prefilled composer action will kick in.

vladimiry avatar Aug 08 '19 13:08 vladimiry

Thanks for the quick reply! I will look into how much effort this will take and reconsider if I am willing to do this for everyone or just me.

Regarding your first point, the registration of the URL scheme, I don't think we need to implement this ourselves (and mess with the Windows Registry and such) as it seems the Electron framework has already taken care of this. There's an API for registering, unregistering and checking default url scheme handlers with the OS.

if at least the integration with the web clients code layer will be covered by automated tests

Could you point me to the sources of the specific tests for the existing web clients for a reference? I searched real quick and couldn't find anything.

Also, would you insist on tutanota support?

heilerich avatar Aug 08 '19 14:08 heilerich

Electron framework has already taken care of this

I've looked into this topic before. Electron handles the need but the implementation is not complete this is why some hacks expected to be needed.

Could you point me to the sources of the specific tests for the existing web clients for a reference? I searched real quick and couldn't find anything.

There are no tests implemented specifically for preload scripts or web clients. Could be Spectron-based, the example is here. Besides I think, depending on the implementation a custom fixture-like page with prepared web client + app custom/integration logic could be loaded and executed using karma runner.

vladimiry avatar Aug 08 '19 15:08 vladimiry

Also, would you insist on tutanota support?

Nope as tutanota support is already deprecated and going to be removed at some point.

vladimiry avatar Aug 08 '19 15:08 vladimiry

@heilerich if you will be considering adding a holistic implementation, mailto URL scheme handling would be the starting point. There will be a need to actually verify that it works on Win 7/8/10, Linux (at least Ubuntu recent + Arch) and macOS. This presumably might be a time-consuming task. By the way, Tutanota's desktop app seems to have some hacks for Windows. The remaining stuff I think I could help with or handle completely, including testing.

vladimiry avatar Aug 08 '19 16:08 vladimiry

With the recent rebase onto Electron 9.0.0-beta.5 is has url scheme handling been improved?

skewty avatar Mar 14 '20 18:03 skewty

Nothing new was done in the app code in regard to handling mailto scheme.

vladimiry avatar Mar 14 '20 19:03 vladimiry

Same issue. I am not able to set as default app in Linux / Ubuntu / Gnome-shell

It can already handle mailto links on a webpage atleast on Linux this is easier (Arch/Xfce), just not the direct compose box...

bbhtt avatar Aug 21 '20 14:08 bbhtt

is this still pending changes to electron or considered a will not do?

ystxn avatar Jul 07 '22 04:07 ystxn

I would like to see this functioning as well.

brcha avatar Jul 09 '22 15:07 brcha

It's unlikely to come in the near future.

vladimiry avatar Jul 09 '22 15:07 vladimiry

yeah i agree this'd be a pretty convenient feature to have

t3dium avatar Mar 14 '23 22:03 t3dium