Java help please

Hi All

I need to send an email to x when the users clicks a button. The email must contain these three variable from the course:

txtName

txtEmail

Please could someone write me the script - just cannot get it right.

Email needs to say

"Dear Natalie,

txtName has completed the course. His/her email address is txtEmail.

Thank you"

Thanks,

Lucia

2 Replies
Michael Hinze

You mentioned three variables, but only list two. I assume, the third one is the destination/target email address?

Try this script snippet:

var player = GetPlayer();
var emailaddress=player.GetVar("targetEmail");
var email=player.GetVar("txtEmail");
var name=player.GetVar("txtName");
var subject="Course Completion";
var body_start="Dear Natalie,"+"\n"+name+" has completed the course. His/her email address is " +email+"."+"\n"+"Thank you";
var mailto_link='mailto:'+emailaddress+'?subject='+subject+'&body='+body_start;
win=window.open(mailto_link,'emailWin');