How to inlcude random password in email text for sending

Hi there,

I have create an email text entry, where the user will enter their email.

After they hit the "continue" button, it will send an email with random password already created, in the text message showing the password to their email account.

they will return to course and enter the password that was emailed to them to access the course.

Below are the JavaScript 

var passwordChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#@!%&()/";

var otp = Array(6).fill(passwordChars).map(function(x) {
return x[Math.floor(Math.random() * x.length)]
}).join('');

var player = GetPlayer();
player.SetVar("NewOTP",otp);

 

var player = GetPlayer();
var email=player.GetVar("RegEmail");
var subject="Access Password";
var body_start="Here is your password ,   %NewOTP% ,    ";
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;
win=window.open(mailto_link,'emailWin');

The %NewOTP% supposed to show the password in the email text to the user. How do include the password in the email text?

 

 

2 Replies