Send Email Action

Can anyone assist me in replacing the Mail To action previously in Lectora? I have previously used this action in a few instances throughout several courses and now have to go back and update all of these. Scanning for forums, I found a post on creating the following javascript:

var email = “sample@mail.com”;

var subject = “My Notes”;

var body = Var_NoteSummary.getValue();

window.location.href = “mailto:” + email + “?subject=” + subject +”undefined

Any help is appreciated.

Discussion (34)

To clarify for my benefit: do you want to mail the contents of the Lectora page somewhere, or open a new message in the student's own mail program (e. g. Outlook)?

Hi, Clammers. It looks like you found an old post of mine. Here it is working in version 18. If you have any problems or need something different let us know.

All I want is what I used to have. Click and link and an email client opens with the email address in the "to" line. I've tried the javascript and it doesn't work. Any ideas before I dump Lectora all together and use something else?

If you tried what I posted and it didn't work you are most likely doing something incorrect. I understand your frustration; I do most of my work from scratch without a delivery authoring tool as it gives me much more freedom to do whatever I want without bloated wonky code but this one is easily rectified.

This line window.location.href = 'mailto:bob@dinkins.com' will do exactly what you said you want to happen. If you copy and paste this into a run javascript action it will open the users email client with bob@dinkins.com already in the To: address. Nothing else.

You are publishing to check, correct, not just using the built in preview? Also, the machine you are working on has an email client set up, right?

Let me know how it works.

I agree with Bob - I just need something simple that will create a new email message (in the user's email client) with the address in the 'TO' field. In my situation, if I want to provide a list of e-mail addresses within the body text of a page, all I need is a hyperlink to 'MailTo' the given address. For example, "Please contact JohnDoe@email.com for questions regarding this section of the training."

Darrel, the solution you provided works properly and is good for filling out a form; I have used something similar for other applications. However, it's more involved that what is needed (and what was offered previously in Lectora).

Hi All, My solution was to go back to my Lectora Version 17 and then copy and paste into Lectora Version 18 any icons that had the send email action attached . This approach seems to work for me. I agree with Clammers a simpler solution within Lectora Version 18 would be better.

Cheers all!

I have Outlook and it's open. I just published the "email button.awt" file as you sent it. The button shows but it nothing happens. That's the issue I found in the first place. The Send Email action shows since it was put in with an older version of Lectora, but Trivantis took out the code behind it, so it doesn't work any longer. It's very frustrating that they would do that.

I appreciate your help, but it's not working for me.

Using the "Send Email.awt" you sent I created a button on the page where you have the message box. I gave it the action OnMouseClick undefined window.location.href = ‘mailto:bob@dinkins.com'. Then published. The only thing that appears is a blank page. It doesn't matter which browser I view it in. I'm viewing locally, not served.

Bob, do you have a mail client, like outlook, on that computer? If there is a mail client it should open up a new email with your address loaded in. Doesn't matter if it is on a server.

You can also try to import the email button object from my other post and then just drag it into a page and change the address in the action. To import the awo, you first save it (desktop works fine) and then open up your "my library" tab in Lectora. Double click the library objects folder and then add file. Browse to where you saved the awo and select it. Now you can drag it into any project and just change the address.

undefined

I think you are exactly right. I found a website that had an email link (hard to find, by the way) and it didn't work. Thanks for helping me with this.

Now, on to research this computer issue!

Here's the email action on a block of text that is styled to look like an email link (underline and different color). Just add to your library then when you add it to your page change the text to match the address you put in the action.

There is something wrong with your computer. Both of the solutions I posted work fine. It appears your computer is not defaulting email to a client application. Does any email link in another application open up your outlook?

Thanks, all. I've been copying-and-pasting the action from prior courses, so this is much easier. However, it doesn't solve the issue with in in-text hyperlinks. I can use this as a workaround, but undefined Lectora, bring back this action.

As Carmelo suggested (good suggestion by the way) here is a button library object from v17 with email action attached. Add to your library objects.

It is, however, advantageous to learn and use a little bit of JavaScript but I understand this is easier.

Thanks again for the suggestion. The MAILTO default was set to Chrome instead of Outlook. It works now. You are a genius!

Bob

I'm glad you got it working.

Clammers you are correct. I apologize. I did not test it beyond the first email. Here are two similar library objects that have the run JavaScript built in. Its pretty much the same as the other two I posted but will work properly. You'll just need to change the address just as you would have with the first ones.

I attempted to incorporate the library object, but when I change the recipient, reverts back to recipient@domain.com

Here is a title as a Lectora Online package file (which you can import to any Lectora) which has a JavaScript action to send email. It allows you to modify variables for the send to email, subject, cc, bcc, and body.

Should work great, please let me know if there is an issue with it.

If we wanted to have the JS automatically put the subject into the email...could we?

This is how I used to do it....Name@Email.com?SUBJECT=CourseCode or Course Name

I currently have my button with an action to Run JS and in the window, I've put: window.location.href = "mailto:NAME@email.com";

The above works fine in ScormCloud, but if I try any variation to add the subject, I only see a white screen in ScormCloud.

Here are the variations I've tried:

  • window.location.href = "mailto:NAME@email.com";?SUBJECT=CourseCode
  • window.location.href = "mailto:NAME@email.com"?SUBJECT=CourseCode
  • window.location.href = "mailto:NAME@email.com";SUBJECT=CourseCode

I have my JS (I took a 1-day class in October) notes at home and I'm traveling, but have someone asking me about it now. Any help would be appreciated!!!

-Chris

Hi,

Question mark only after the email address and move the quotes to the end, like this:

window.location.href = “mailto:NAME@email.com?SUBJECT=CourseCode"

undefined

Hi Tim-

Thank you for your response, but I still think I'm missing something...I put the OnMouseClick Action of "Run JavaScript" and in the Target put “mailto:NAME@email.com?SUBJECT=CourseCode"

When I try to test it in ScormCloud, the page doesn't even show, I just see a white screen. If I remove the "SUBJECT=CourseCode" section, I can see it.

I've attached the page in case that might help.

Thoughts?

-Chris

Try SUBJECT in lowercase.

It still shows up a page of white. :(

The first quotation mark appears to be a smart quote. This can be easily noticed if you copy/paste into notepad or a similar text editor. If you have code that is inexplicably not working it's always a good idea to try this to identify an abnormality. See attached. Replace the first quotation mark with a standard one and you should be good.

quotemarks.png

Is this the correct java Script? window.location.href = ‘mailto:bob@dinkins.com

I am currently having the send email issue above. I have the send email action from Lectora 17 but when I open the course in a newer version the action no longer works. I tried the java script option but all I get is a blank screen and I am not having issues with opening links that populate email addresses otherwise.

Any suggestions.

undefined

Where to I find the MAILTO default setting?

By the way, I suggested using the JS

window.open('mailto:test@example.com');

And that seems to be working for Lisa.

We had similar issues with ios devices. It seems to be related to making sure their is a default email application tied to the default applications for email on the ios device. In our case, with thousands of devices that would need that option updated to work we decided to just make it a pop up message with the email address they should send the email to. The user then would have to copy and paste it. Not optimum but until we can make sure all ios devices are set up correctly this email action will not work.

If you come up with another solution please share. Thanks!

I am using Lectora 17 and I have been trying to use the following code to send an email that contains resources from a course where the learner will self-populate their email address. The learner can then access the email for reference at a later time. The email function works when I test it locally and functions in production (via our LMS) on the desktop view. When I try to generate the email on a mobile device (via our LMS) there is no response and the email client never opens/responds. Any ideas?

window.open(“mailto:?subject=Resources&body=Subject goes here. Link to resources goes here.”)

I can't download these .awo files. I get a Failed-Forbidden message

Good morning, I have Lectora Inspire 18 and have been using it for a training that goes out to all of our employees. There are three sections in the training where I have an action set up to send an email to a specific email address. I am trying to change the email address to something new within the action type below but it wont keep it. Each time I get out and go back into it, it defaults to the the old email again. Also I tried creating a new send email action again but I don’t even see the send email option anymore. Was it removed? If so how are people included email address as a point of contact in a training module so it opens the email in outlook right away when someone clicks on the link.

People are mentioning to just add a javascript but what should I put exactly, I only need for it to open an new email in outlook with just the "To" auto populated, nothing else needed.

... I am trying to change the email address to something new within the action type below but it wont keep it. Each time I get out and go back into it, it defaults to the the old email again.

There's nothing below ... did you forget to attach or quote something?

I've had something similar happen before, when an AWT file got corrupted. It has been a few years since I had to rename and manually edit the AWT. (It's just an XML file.) I'd bet that ELB support could help you.