I found THIS pretty good explained script HIER to add the unsubscribe option to my mail merger. It´s even recommended by Google. I´ve managed to install it, but I can´t figure out which value I should put in the last curly brace (so, {{TOKEN}}
) in the HTML code below, because this is the first time ever that I work with tokens. Can somebody please help? I mean how would the value for {{TOKEN}}
look like? Thanks :)
Here is the HTML code where I need assistance:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>We are testing our unsubscribe feature</h1>
<a href="{{WEBAPP_URL}}?email={{EMAIL}}&unsubscribe_hash={{TOKEN}}"> Unsubscribe </a>
</body>
</html>
CodePudding user response:
WHAT?
WEBAPP_URL
The url of you web application.
EMAIL
The email of the recipient.
TOKEN
Possibly a random string (hash) that is generated for each recipient (and may be also each email).
HOW?
The replacement should be done when you are creating the emails.
The exact method depends on the tool (and such language) you use.
Commonly, you need to replace
the values with the actual value stored in a variable
Here, I assume it is Google Apps Script.
var html = HtmlService.createHtmlOutputFromFile('index');
var content = html.getContent().replace('{{EMAIL}}', email);
/* ... */
An alternative would be to use scriplets
.
Reference: