Email notes to self on click

May 27, 2020

Hi all,

My JavaScript has gotten extremely rusty...

What I want to do is have 2 text entry boxes. One for email address, one for content input.

The button underneath will then pull the email address into a mailto:%TextEntryEmail% and the body of the email will output %TextEntryBody%. Subject could be "Notes to self" or something.
I have done something similar to this before but it was a long time ago and I was fortunate enough to have had a JS guru with me.

Would somebody be able to do me a HUGE favour and give me a boilerplate to work with? If i have a starter to look at i should be able to figure it out. 

Thank you so much!

Nath

5 Replies
Nathan South

Hi Matthew,

Thank you so much for your demo page I found it incredibly useful!

My needs have changed for this and I'm really struggling to iron out the kinks. I figured I'd ask before getting too far lost! What I'm looking to do is have this automatically populate with a generic inbox for our L&D team and Cc in two of our trainers. The body will then populate with the entered text in the large box and the email address that the user entered to say who it is from too.

Review link is below so you can see what I'm working with.

https://360.articulate.com/review/content/c586c187-17d5-4c3d-b709-5a464b35bbe6/review


My code is below...

var player = GetPlayer();
var email = '**L&D Generic Inbox**';
var cc ='*&Two Trainer emails go in here**';
var fbk = player.GetVar('Feedback');
var subject = 'Course Feedback';
var emailBody = 'Questions for the L&D trainer' + '\n' **from entered email address** + fbk;
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');


I hope I have explained everything well enough.

Thank you again,

Nathan

Sam Hill

Hi Nathan, for the CC just do something like this. I can see in your script you weren't pulling down the from email address from SL, so I added that too.

var player = GetPlayer();
var email = 'jim@somewhere.com';
var cc ='jen@somewhere.com;jeb@somewhere.com';
var fbk = player.GetVar('Feedback');
var useremail = player.GetVar('useremail');
var subject = 'Course Feedback';

var emailBody = 'Questions for the L&D trainer' + '\n' +useremail+'\n' + fbk;
var mailto_link = 'mailto:' + email + '?subject=' + subject +'&cc='+cc+ '&body=' + encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');

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