LeeTee LeeTee - 1 year ago 86
Javascript Question

Node Webkit- opening and sending emails via outlook

I have a cordova app that I want to run on desktops using Node Webkit.

I need to replace cordova.plugins.email() function with a Node Webkit equivelant but am struggling to find the info I need.

Can anyone help?

//email composer
$('#stage').on('click', '#email', function(event){
var pdfatt = (this.getAttribute('data-pdfemail'));
var profforename = window.localStorage.getItem('profForename');
var profsurname = window.localStorage.getItem('profSurname');
var profemail = window.localStorage.getItem('profEmail');

function (isAvailable) {
body:'<p><img src="wp-content/uploads/2016/06/Email_Header.jpg"/></p><br><br>From:<p>'+profforename+' '+profsurname+'</p><p>Tel:'+proftel+'</p><p>Mob: '+profmob+'</p><p>Email: '+profemail+'</p><br><br><a href="'+pdfatt+'"><img height="30px" src='+baseurl+'"/wp-content/uploads/2016/06/download-pdf.jpg"/><br>Click To Download the PDF</a><br><br><br><p><img src="/wp-content/uploads/2016/06/Email_Footer.jpg"/></p>',
subject: 'subject',
isHtml: true
//alert('Service is not available') unless isAvailable;

The above code basically opens up a new email and pre-populates the email. I cannot find much information out there on how to do this. I have come across nodemailer but I don't think this is what I need as I would want to open up and email in Outlook and prepopulate, leaving the user to add the email address.

Many thanks

Answer Source

oh this is so simple, not sure why I tried to overcomplicate it! Turned out I sneeded to use the Nodewebkit GUI Library.

// Load native Nodewebkit UI library.  
var gui = require('nw.gui');

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download