Node Webkit- opening and sending emails via outlook - javascript

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><img height="30px" src='+baseurl+'"/wp-content/uploads/2016/06/download-pdf.jpg"/><br>Click To Download the PDF<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

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

Related

Javascript works in Adobe Reader but not in Nitropdf

I have setup an interactive PDF form with a Javascript button to submit the form by email, extracting data input by the user. The button works fine in Adobe Reader but does nothing in NitroPDF. Is there a problem with the code (see below)?
var cToAddr = this.getField("ComboBox1").value
var cSubLine = "Property Transaction Form " + this.getField("Text1").value
var cBody = "The attached file is the filled-out form. Please open it to review the data."
this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody})
With the plethora of PDF viewers out there that implement only some of the Acrobat JavaScript API - some more, some less - I recommend testing for the existence of any functions that your document requires before trying to use them. Wrap your code in the snippet below to let the user know that they are using a less capable viewer than what you've programmed the document for.
if (typeof this.mailDoc == 'function') {
// The viewer can mail documents
}
else {
// Warn the user somehow
}

Meteor: Authenticating Chrome Extension via DDP

I've built a Chrome Extension that takes a selection of text and when I right click and choose the context menu item, it sends that text to my Meteor app. This works fine, however, I can't figure out the process of using Oauth to authenticate users.
I'm using this package: https://github.com/eddflrs/meteor-ddp
Here is the JS within background.js (for Chrome Extension):
var ddp = new MeteorDdp("ws://localhost:3000/websocket");
ddp.connect().then(function() {
ddp.subscribe("textSnippets");
chrome.runtime.onMessage.addListener(function(message) {
ddp.call('transferSnippet', ['snippetContent', 'tag', snippetString]);
});
});
Here is the relevant portion of my other JS file within my Chrome Extension:
function genericOnClick(info) {
snippetString = [];
snippetString.push(info.selectionText);
var snippetTag = prompt('tag this thing')
snippetString.push(snippetTag);
chrome.runtime.sendMessage(snippetString);
}
And here is the relevant portion of my Meteor app:
'transferSnippet': function(field1, field2, value1, value2) {
var quickObject = {};
quickObject.field1 = value1[0];
quickObject.field2 = value1[1];
TextSnippets.insert({
snippetContent: value1[0],
tag: value1[1]
});
}
Basically I'm stuck and don't know how to go about making a DDP call that will talk to my Meteor app in order to authenticate a user
This question is a bit old, but if anyone is still looking for a solution. I had a similar problem that I was able to solve using the following plugin: https://github.com/mondora/asteroid. Here is an example of how to do it for twitter oauth:
https://github.com/mondora/asteroid/issues/41#issuecomment-72334353

Open Sharepoint folder with windows explorer from CRM 2011

I've been struggling with this issue for a while now,
and hope maybe someone in the community can provide a resolution.
I have a requirement which is to put a button on the a CRM account form which will have the same logic as the Open With Explorer button in a Sharepoint document library. The logic is required as the users have to do several click in order to get to this button, and open the required account's folder in windows explorer, which are:
Click Documents in navigation of the form, to open SP integration
Click documents in the SP view
Click library
Click the Open With Explorer button
The CRM is integrated with Sharepoint, and when the folder is opened in windows explorer it has the following sample link
http://{sharepoint}/CRM/7F9F72A1-4591-E011-AC6C-00155D773703/Documents/
Where the GUID 7F9F72A1-4591-E011-AC6C-00155D773703, is the account id in CRM.
From my research i have found that the javascript function that achieves this is
NavigateHttpFolder from the sp.js in Sharepoint.
From this function, and this link About Web Folder Behaviors
I've completed the following function.
var httpFolderDiv = document.createElement("SPAN");
function NavigateToFolder() {
document.body.appendChild(httpFolderDiv);
httpFolderDiv.onreadystatechange = NavigateToFolder;
httpFolderDiv.id = "navDiv";
httpFolderDiv.addBehavior("#default#httpFolder");
if (httpFolderDiv.readyState == "complete") {
httpFolderDiv.onreadystatechange = null;
var link = "";
var account = "";
var accountid = "";
var id = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");
link = "http://{sharepoint}/CRM/" + id + "/Documents/";
try {
httpFolderDiv.navigateFrame(link, "_blank");
} catch (c) {
alert(c.toString());
}
}
}
This function opens up the folder from Sharepoint in windows explorer, but with limitation if only that folder was previously opened directly from Sharepoint.
I believe that the logic I am missing in the code, is that I don't do mapping of the folder, the way sharepoint does.
I am aware that this folder can be mapped manually as a network drive, Connecting WebDAV Server Using Web folders, but this will not do the trick for me as this will have to be done on every client.
How can I achieve this by grabbing the complete logic from SP, or maybe running a console command from javascript to map the folder prior to opening it with the above function.
I know it's been a while, since this has been posted, but I stumbled upon it while searching for the exact same problem.
Here's what worked for me in SharePoint 2013:
<a href='#' onClick="javascript:CoreInvoke('NavigateHttpFolder', '[path to site]/[library name]/', '_blank');">
Click to open in Explorer
</a>
It's essentially the same function used by SharePoints own functionality.

Autofill And Login to GoogleMail with javascript

So I am building a WebApp. There I want to have a Button to open and AutoLogin to the GoogleCalendar. I already tried to create a js but i guess i did something wrong.
The js Code:
var popupWindow;
function OpenCalendar() {
popupWindow = window.open('https://accounts.google.com/ServiceLogin?service=cl', 'Calendar');
popupWindow.focus();
popupWindow.document.getElementById('Email').value = 'mail';
popupWindow.document.getElementById('Passwd').value = 'pass';
}
You cannot access any resource from other domain through JavaScript. It is restricted due to security reasons. In short this is not possible.
You can take a look at Google Accounts authentication and authorization here at this link https://developers.google.com/accounts/

javascript mailto attachment not showing up

i'm trying to create a small web app wherein in one form, the user may type in certain parameters as part of the message, then after he hits a button, it will show an Outlook (depends on his default email client) email client popup with all the details he placed.. and then it will include an attachment.
the javascript code looks like this:
function submitReport()
{
var remarks = document.getElementById('remarks').value;
if(remarks != '')
body += 'Remarks: '+remarks;
var href = 'mailto:bug_support#emailadd.com?subject=[Bug Report] '+menu_path+'&body='+body;
href += '&attachment="C:\\debug.log"';
var form = DomUtils.createForm();
form.setAttribute('action', href);
form.submit();
}
i tried alerting the "href" variable and it shows:
mailto:bug_support#emailadd.com?subject=[Bug Report]&body=message_bodyReport Type: MonthlyStart Date: 2010-05-01 00:00:00End Date: 2010-05-31 23:59:59&attachment="C:\debug.log"
and surely an outclient popsup with all the subject, recepient email address, body..
but no attachment. anybody encountered this before? :(
the outlook used here is 2007..
if i run the web app in IE, it actually says an error
"The command line argument is not valid. Verify the switch you are using."
any ideas?
There is no way for a web page to cause a browser to open the user's email client with a file pre-attached from the hard disk.
Use a form and process it server side, or provide simple instructions along the lines of:
<p>Send an email to foo#example.com
and attach your log file.</p>

Categories

Resources