Forum Discussion
Andrew35
9 months agoCommunity Member
Javascript for sending an email
Hi there Hope someone can help tell me what's wrong with my JS for sending an email with Text Entry data. For context I want the email to go to a specific address and it will contain the text entri...
- 9 months ago
Both let and var create new variables in JavaScript. The difference between the two is their scope.
- A variable declared by let is only available inside of the block in which it is defined
- A variable declared by var is available throughout the function in which it is defined, or globally if it's defined outside of a function
MathNotermans-9
9 months agoCommunity Member
Basically you got your variables wrong. You have 3 times the variable text... and in your emailBody you refer to TextEntry1,2 and 3... being the inputfields and not the variables.
It needs to be something like this...
let player = GetPlayer();
let ip1 = player.GetVar("TextEntry");
let ip2 = player.GetVar("TextEntry1");
let ip3 = player.GetVar("TextEntry2");
var email="test.test@gmail.com";
var subject="subject line";
var body_start="How you want to begin your body." +ip1+" "+ip2+" "+ip3;
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;
win=window.open(mailto_link,'emailWin');
Sample shared...
Andrew35
9 months agoCommunity Member
Thank you. I copied what I had seen from others on here. What does let mean or do then because every other one I've seen had var in this part?
Also, do you know if this will give me the format I need above? To be clear Question 1 etc. is not part of the text entry variable.
Andrew
Related Content
- 5 months ago