Email Text Body using Button and JavaScript

Jan 26, 2021

I have created an email button and am using JavaScript.  I can get the email, subject line and the first line of the email body.  What I would like to do is extract the information from the 3 text boxes using a JavaScript trigger when the submit button is pressed, and then put it into the main body of an email.  I am new to JavaScript.

I have this JavaScript so far: 

var player = GetPlayer();
var email = 'training@dbiservices.com'
var fbk = player.GetVar('Feedback');
var subject = 'My Three Initiatives';
var emailBody = 'Here are my three initiatives:' + '\n' + fbk;
var innitiative1=player.GetVar("%textentry2%");
var innitiative2=player.GetVar("%textentry3%");
var innitiative3=player.GetVar("%textentry4%");
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' +
encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');

Be the first to reply