Need help with JS to send an email from a course that includes variables from the course

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

9 Replies
Stephanie Vobornik

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!

Russell Killips

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 Killips

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.