6

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');

     cordova.plugins.email.isAvailable(
         function (isAvailable) {  
          cordova.plugins.email.open({
          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

LeeTee
  • 6,401
  • 16
  • 79
  • 139
  • try this: var gui = require('nw.gui'); gui.Shell.openExternal('http://www.google.com'); – Naitik Aug 11 '16 at 11:23
  • thats exactly what I am doing already but I want them to open in webview instead – LeeTee Aug 11 '16 at 13:35
  • `webview.src = 'https://gmail.com'`? – Nebula Aug 11 '16 at 19:48
  • Hello dear can you see this link and check your requirement is full filled or not https://codeforgeek.com/2014/07/send-e-mail-node-js/ – Yogesh Rathi Aug 12 '16 at 09:36
  • Hi, Sorry I have just realised I missed a vital bit of info!! I need to to open in Outlook. The instructions I find all seem to send an email from a form via gmail which is not what I need to do. I have edited my original query. – LeeTee Aug 12 '16 at 14:54

1 Answers1

6

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');

gui.Shell.openExternal('mailto:test@example.com?subject=test&body=hello');
LeeTee
  • 6,401
  • 16
  • 79
  • 139