Need help with JS to send an email from a course that includes variables from the course
Jul 12, 2016
Hello all. I have a course where we ask participants to enter their first name, last name, student id and email address into text variables within the course. What I want to happen is to have an email sent to an administrator here at the college when they click the submit button after entering the variables. I would like the email address to populate in the to field, the subject line to read: Online NSO Started and the body of the email to read:
First Name Variable
Last Name Variable
Student ID Variable
Email Address Variable
has attempted the online version of NSO.
I've read several other threads on this topic, but I'm unclear if I need to create additional variables within the course to make the script execute, and also what code I actually need.
Any help would be greatly appreciated.
Thanks,
Stephanie
8 Replies
Hi, Stephanie -- Thanks so much for reaching out here! Unfortunately, we are not able to provide support for use of JavaScript, but there are lots of members here in the community who are quite savvy and are happy to assist! And in case you wanted to check it out, here is our JS Best Practices and Examples sheet.
Hello Stephanie,
This should work for you.
Russell, thank you so much! This worked perfectly. I appreciate it. I fought with this forever and it only took me a few minutes to implement what you shared.
One more quick question for you...is there a way to modify the script so that the email goes off automatically without launching the window where users can see it and have to hit send? I want it to basically happen without the learner knowing it is happening....it is really just for record keeping purposes at the college.
The send from could either be populated with the student email address variable, or a "generic" email address that we could set up here at the college whichever makes more sense.
Thanks!
Thanks. I had looked at those previously, but was still having trouble. Russell provided exactly what I needed though!
Unfortunately, I don't know how to make it automatically send the message. Please note that this method will not work if the students machine doesn't have a client email program configured.
I did come up with a different solution for a client. Instead of sending the mail from the student machine, I sent the mail from the server where the LMS is. The LMS server had PHP installed. The PHP installation was also configured for sending email. I wrote some PHP code that would send the message out.
Russell - I noticed in the Email.story example. Every time I click submit, it would close out the course. Do you have any suggestions to prevent that?
Thanks.
Hey Ted,
Thanks for reaching out here, although I'm not sure that Russell is still subscribed. You may want to try and message him directly using the "contact me" button on his profile to see if he's able to share some more detail with you.
Sorry Ted, I don't know why it doesn't work for you.
I have just tested it on both my mac and pc.
On the PC, I use thunderbird as an email client. I click on submit and thunderbird opens with the email ready to send. On my mac, the Mac Mail program opens with the email ready to send. The web browser stays open with the course running.
This discussion is closed. You can start a new discussion or contact Articulate Support.