Question

I'm trying to specify a mailto link in an HTML template, for a Google Apps script. Unfortunately, the link:

<a href="mailto:foo@bar.com">

is converted to

<a href="mailto:foo%40bar.com">

because of the processing involved.

How would I return the correct mailto link?

More simply when I do return HTML via a call:

function doGet(request) {
   return HtmlService.createHtmlOutput('<a href="foo@bar.com">mail me</a>');
}

the returned HTML is:

<a target="_parent" href="mailto:foo%40bar.com">mail me</a>

which is OK for some mail applications (Mac Mail) but is not the standard.

No correct solution

OTHER TIPS

This is not the ideal answer that I was hoping for but it is a solution to the problem. As is turns out if you have Caja processor evaluate your HTML in Native mode, it won't do this '@' -> '%40' translation.

return template.evaluate().setSandboxMode(HtmlService.SandboxMode.NATIVE);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top