How do you open preferred email client from an electron app?


Hello everyone,
I’d like to know if it is possible to open the preferred OS email client and add an attachment from an electron app.

Thank you in advance


The only way I know to open the default mail client is with a mailto: (using shell.openItem) which includes subject, body,cc but no attachment. I would find this useful too.


Hi Robert,
Thanks for your info, that’s something that i did not know. Do you have an approx idea how hard would be to add this functionality?


Actually this has already been done.

Actually this sends an email with attachment without the use of the email client. So this would do what I am looking for but doesn’t open email client.


Yes, i knew about that. But I’m trying to open user email client and add an attachment to a new email.

It feels like this feature is missing.


I think this is a limitation of email clients and their implementation of RFC 822 maybe. Don’t think you will find a good solution opening email client with attachment. You can insert a link to the file in the body of the email with mailto though…


I don’t think cross-open the preferred email client has something to do with the RFC itself. I actually believe that Electron should be able to “detect” which is the preferred email client by “asking” to the OS… and this functionality is missing for now. I hope it will be implemented at some point.


Has anyone wrapped nodemailer in an Atom package? I would find it very useful to be able to quickly shoot a markdown document as an attachment. My use case is documents that contain math markup rendered with MathJax, to exchange with other scientists.