Forum Discussion
Need Javascript to open Outlook and send email from inside sl360
I am a novice at JS. Can anyone make this javascript open Outlook, send an email to a specific mailto: address, so learners can ask questions?
Here is my current JS
var player = GetPlayer();
var email='';
var subject='VCI Complaint Management Question';
var feedback=player.GetVar('MyQuestion');
var emailBody = +feedback
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);
win=window.open(mailto_link,'email@xxxx.com');
- WaltHamiltonSuper Hero
I'm not in a position to test your script, but one thing comes to mind. If it isn't working at all (you didn't say what is happening,) you might consider changing ' to ". There have been reports of SL having problems with changing ' to something that doesn't work.
Also, if you are using Outlook as a generic term to mean email app, fine. But if you want Outlook specifically, the mailto command opens the default email, and is under the control of the settings on the learner's computer, not yours. See Maria's first post in this thread:
- PhilMayorSuper Hero
Are you getting any errors in the console?
- JanetMinchel681Community Member
Nothing happens when I run the js. Computer screen just remains the same.
- PhilMayorSuper Hero
Open the console to see if it throws an error
Sent from my iPhone
- Jürgen_Schoene_Community Member
try
var player = GetPlayer();
var feedback = player.GetVar('MyQuestion');
var email = 'email@xxxx.com';
var subject = 'VCI Complaint Management Question';
var emailBody = feedback;
var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);
window.open(mailto_link,'_self');result:
https://360.articulate.com/review/content/f30e9e0a-7c08-4180-bea3-b99aa966e36d/review
- JanetMinchel681Community Member
Thank you Jürgen!
However, this did not work. This opens google and I need it to open MS Outlook. Any suggestions?
- PhilMayorSuper Hero
It will only open the email client that is set as default on your machine, you cannot specify the client.
Sent from my iPhone
- JanetMinchel681Community Member
Thank you!