Forum Discussion
Export Variable Values via Email Message using JavaScript
Hi Natalie
I guess the first question is: "Is the code working in Storyline?" There are a couple of reasons it might not be.
A small precaution you might want to take is to URL encode the subject and email body line:
var subject = encodeURIComponent('Subject Line Here'); // URL encode the subject
var emailBody = encodeURIComponent('Your email content goes here.'); // URL encode the body of the email
This removes the risk that special characters in the subject line are misinterpreted as control characters within the mailto: statement:
window.open('mailto:' + emailAddress + '?subject=' + subject + '&body=' + emailBody);
The other limitations using this method are:
- The method relies on the user having a default email client set up that handles
mailto:
links (as per my earlier post in this thread this might not always be the case). - Some browsers or security settings may block
mailto:
operations, especially if pop-ups are disabled. - The amount of text that can be sent via a
mailto:
link might be limited, depending on the email client.
If it works OK in Storyline then it should work in RISE - but there is another whole layer of complexity introduced and your problem might be related to security policies set up on the hosting platform.
You might want to consider using an alternative approach sending the email through an intermediary service - I posted an article on this some time ago:
Hope this helps...