Forum Discussion
How to send quiz results via mail automatically via Javascript
Hi all,
until now I am able to let create a mail with the results of 5 quizzes automatically.
But the learner could adapt that mail text and has to hit the "Send"-button in his mail client.
How to send the mail automatically?
What I did to let it work so far:
1. Created 5 global variables (r1, r2,...r5) in which the resultvalues are stored
2. Created 5 events ("r1 = Results.ScorePercent", "r2 = Results1.ScorePercent"...) to store the result values in these global variables
3. Assigned this Javascript code to a button:
var player = GetPlayer();
var status=player.GetVar("completion");
var email = 'recepientsmailaddress@here.com';
var r1 = player.GetVar('r1');
var r2 = player.GetVar('r2');
var r3 = player.GetVar('r3');
var r4 = player.GetVar('r4');
var r5 = player.GetVar('r5');
var subject = 'My quiz results of XYZ Quiz';
var emailBody = 'My quiz results:' + " " + r1 + ", " + r2 + ", " + r3 + ", " + r4 + ", " + r5;
window.location.href='mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);
- KarinHuditzCommunity Member
Okeeeee... :D As I'm having over 80 questions that would be far too much work to do in my eyes. ;) . Better I go first back to the department who has the need for that e-learning to ask them if they really need that. Or if we just make a combination of mail and the standard result sheet... Naming the answers in a way, the learner doesn't figure out which answers are meant.
But thanks a lot for showing me this way. I wouldn't have thought of it. Learned something today. :)