Send an email using javascript from Storyline

May 09, 2016

Hi I am looking at ways to sent an email from within Storyline 2.

I want to have the email address left blank (as the learner will fill this in once their email application opens). I also want the subject link to be populated and for the body text, I want it to have a list of URL's the learner can click on once they have received the email.

I found some javascript a while ago, but cant seem to find the thread again.

Here is what I found:

var email=player.GetVar("EmailAddress");

var subject=player.GetVar("Topic1LibraryValue");

var body_start=new Array();


var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;,'emailWin');

Would it be possible to leave the email address blank and somehow add in multiple lines in the body text where I can just add in the text and URL links within the javascript (instead of using a variable)?

If anyone could help on this I would really appreciate it.

7 Replies
Designboy Chris

Hi there, I've got this working, but in my little fat heart - I really, really wanted to get it to use the server the files sit on to use  php to post the message - can I do this? Is it possible?

Something like:

$to = '';
$subject = 'the subject';
$message = 'hello I love emals';
$headers = 'From:' . "\r\n" .
'Reply-To:' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

Make me happy! I know you are all smart and nice.


Designboy Chris

Great! I'm happy I cheered you up.  I'm surprised that an email variables function is not native to the software, guessing it is the flash element of it. But flash can send emails fine from my time spent with it years back. So hoping it is a sort of easy to reach fix!

Would there be a clever way to use a TINCAN route to let me store the variables of a competition that is easy to set up? Last time I looked at it I had to buy a monthly package.

Ashley Terwilliger-Pollard

Hi Chris,

We don't have an email results feature (or an email functionality from within the apps) as detailed a bit more here. So it's also dependent on the email client installed more so than the Flash elements of Storyline. 

If you're looking at storing or reporting variables, it could be handled by Tin Can or a SCORM published course that you've upload to an LMS. As for writing specific variables, if you're looking at using certain Tin Can statements the customization of those is again something I'd have to defer to the community in regards to but you could take a look at the information here to get you started in Tin can.  I'm not sure which element you are referring to in terms of having to purchase? Perhaps you're thinking of the LMS that authors are subscribed too? 

Curtis Kynerd

Could someone look at this story file and give me advice?  I have a slide that is used to provide feedback to the instructor.  THe learner is able to type their feedback and generate an email back to the instructor.  The JavaScript is used successfully in other courses, but for some reason this one does not seem to work.  I have looked at it and can't find what is wrong.  Is anyone out there available to tell me where I am going wrong?  I greatly appreciate it!!!

Ashley Terwilliger-Pollard

Hi Curtis,

Thanks for sharing a copy of your .story file here and hopefully someone in the community will be able to take a look at the code in question. I do know that a few other users were discussing the inconsistency of the Javascript "send email" code, as it's going to rely on the individual user having an email client installed on their system and as more and more people move to a web based email client (think Gmail or Yahoo) it becomes less reliable.  You'll also want to take a look at the information here in regards to the Javascript best practices while you wait for some community insight. 

This discussion is closed. You can start a new discussion or contact Articulate Support.