problem sending mail with javascript

Oct 02, 2013

hi i just try to send mail by javascript, but i can´t to achieve it!

i have 6 textbox defines with each variables, (Question1, Answer1 ...)

then, i set up the send button with the trygger "Execute Javascript" putting there:

var player = GetPlayer();

var Q1 = player.GetVar("Question1");

var A1 = player.GetVar("Answer1");

var email="teacher@domain.com";

var name="Juan Carlos";

var subject = "Ejercicio enviado por alumno UN2.3 INGLES";

var body_start = "Dear Teacher,\n" + name + " has sent you his/her answers:\n";

var body_end = "Please discuss this commitment with " + name + "\n";

var mailto_link = 'mailto:' +email+'?subject='+subject+'&body='+encodeURIComponent(body_start + Q1 + A1 +  body_end);

win = window.open(mailto_link, 'emailWin'); 

but when i publish the html5 project i don´t get it to work fine!

My mail form is on a new layer (with 6 fields and the send mail button):

May be i didn't write the js right! what do you think? can you give me a hand on that (or some video tutorial)?

regards

juanma

12 Replies
Dennis Hall

Hi Juanma:

I have both the Flash and HTML5 correctly working the same in FireFox and I.E.

My only comment would be to inser spaces between your Question1 and Anser1 output in the email formating.

Maybe you were missing the Q1 and A1 Vars. Not sure.

I have attached my story for you to compare to yours.

If this helps, please mark this as solved so others may find it for their solutions as well.

Best Regards,

Dennis Hall

stanton mackellar

Dennis Hall said:

Hi Juanma:

I have both the Flash and HTML5 correctly working the same in FireFox and I.E.

My only comment would be to inser spaces between your Question1 and Anser1 output in the email formating.

Maybe you were missing the Q1 and A1 Vars. Not sure.

I have attached my story for you to compare to yours.

If this helps, please mark this as solved so others may find it for their solutions as well.

Best Regards,

Dennis Hall


Hi Denis, I was trolling for some Java script help and found your very helpful post. It works great... until I try to use it in my story: then it suddenly stops working. I'm no java programmer, but I can copy and paste with the best of them. I imported my story into yours, and it worked at first. But when I tried to adjust it to fit my purpose, then it suddenly stops calling the email client... and even though I retain the original from you in a seperate scene, it also inexplicably stops working...

I also thought that maybe I could just use HTML, which is easier for me to parse. Is there a  way you can pull a variable into a mailto: ? You can see I tried but failed.

Happy for anyone to offer up some suggestions.

Thanks

Stanton

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