MailTo Function for Bug Reporting
Nov 19, 2013
By
Chad Lowman
I'm currently working on a Bug Reporting feature for a course and for some reason my email body is showing up as truncated. Here is the script I'm using:
var player=GetPlayer();
var email="email@email.com";
var subject="Bug_Report";
var body_start="Attention! I found a potential error in the following training. The name of the training is: "+ player.GetVar("CourseName") + player.GetVar("Module") + player.GetVar("Frame");
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;
win=window.open(mailto_link,'emailWin');
I've also created three variables (CourseName, Module, and Frame) in Storyline to contain these variables.
Any ideas on how I can correct this?
Thanks..
7 Replies
Hi Chad:
I looks like you need to create some temp vars and add tehm into your JavaScript.
I've attached a contact form Story that you can run out-of-box to compare.
Notice, in the script, I have created vars to assemble the email message and do not call GetPlayer in the email assembly part of the script.
Hope this helps you get on the right track with this form.
Best Regards,
Dennis Hall
Hi Chad,
I'm glad you're getting some help here from Dennis, and I just wanted to welcome you to E-Learning Heroes!
Yup that worked! Thanks for the help!
Nice, thanks for the update Chad!
Hi Everyone,
I am struggling to get this feature to work, here is my JavaScript code which is based on Dennis's but I do not receive an email:
var player = GetPlayer();
var name = player.GetVar("lbname");
Var problempage = Player.GetVar("lbproblempage");
var problemdesc = player.GetVar("lbproblemdescription");
var email= player.GetVar("MyEmail");
var subject = "Please help me in my course";
var body_start = "Hi" + name + " has sent the following question while in a course:\n";
var body_middle1 = "Problem spotted on page: ";
var body_middle2 = "Description of problem: ";
var cr = "\n";
var body_end = "Thank you";
var mailto_link = 'mailto:' +email+'?subject='+subject+'&body='+encodeURIComponent(body_start +body_middle1 +lbproblempage +cr +body_middle2 +lbproblemdescription+cr +body_end);
win = window.open(mailto_link, 'emailWin');
Also attached is a screenshot of any relevant variables:
Any help would be greatly appreciated.
John
Hi John,
You may want to send a PM to Dennis as I'm not sure he's still subscribed to this thread. I also wanted to point out some known reasons why the email trigger may not be working and some information on Javascript best practices.
Besides the obvious limitations of the user having an email client, etc., the URI component has a limitation in length. In Internet Explorer, the limitation is 2,083 or 2,048 characters (see MS). Firefox (approx. 65,000), Chrome (unknown/documented limitation), Safari (approx. 90,000), and Opera (approx. 190,000) can handle much longer URIs. Yet according to the specs, HTTP has no limit to URI. Using data URI, Chrome and Firefox can handle about 2MB and 1MB respectively.
So handling the data or sending emails across browser can be problematic without access to the email protocols on the server.
This discussion is closed. You can start a new discussion or contact Articulate Support.