Passing variables to email


(Robert Fant) #1

As an “Action,” I want to compose an email.
That is simple enough but, is it possible to send JavaScript variable values into the body of this email?

Thanks,
Robert


#2

Hi @rfantster

As I don’t know how you’re composing / sending an email it’s difficult to give you an exact solution however…

Here is an example of sending an email using the “mailto” link format


var subject = encodeURIComponent("An example Subject line");
var cc = "cc@example.com";
var name = "Bob";
var message =  encodeURIComponent("Dear " + name +",\n\nThe message to include in the body" );
var link = "mailto:example@example.com?subject=" + subject + "&cc=" + cc + "&body=" + message;

window.location.href = link;

All of the above would be run in a function on Mouse Click of whichever element you want to fire the link.


(Robert Fant) #3

Hello DBear,

I may be able to make your suggestion work. That looks reasonable.

How I’m composing my email: It is one of the “Actions” offered in the "Actions Inspector."
In there you can place the email address, subject, and body. I was just wondering if I could send variable data to these spaces.

However, it looks like your idea might do just as well.

Thank you Sir,
Robert


#4

This … you cannot do and this was my assumption which is why I offered the JS way :wink: which essentially does the same thing but is in code