Electron: Open default email client

2019-08-18 05:44发布

问题:

I am using election framework to built .exe and .dmg files. In the app I have a button, clicking on which it must open default email application installed on the system to send an email. Following is the code to open email client

shell.openExternal("mailto:xyz@abc.com?subject=MySubject&body=");

But, it only works on few systems.

Note: It is already checked that other systems also have default email client. Is there any better way to do it. So, it will work on all system? Thanks in advance for providing help and your precious time !

回答1:

Unfortunately, the code shell.openExternal("mailto:xyz@abc.com?subject=MySubject&body="); only launches the MUA which is configured as the default in the system settings. Oftentimes in older version of windows there is no default mail client set and so it won’t work regardless.