We're trying to encode/decode email addresses in our Preference Centre links to make sure we're not sending PII. We can successfully encode the email value, the microsite is finding the variable in the URL and loading all of the respective data from the Data Extension. However the actual Email value shown on the page is the encoded value, not the decoded one.

In the Email

%%[SET @email = AttributeValue("emailaddr")
   SET @email = Base64Encode(@email)
<a href="%%=RedirectTo(Concat('https://pages.e.client.ca/page.aspx?QS=38dfbe491fab00eac06ff37e2fd23b529c19ea53a02fd1d237dabf07963e6c65&email=',@email,'&unsub=true'))=%%" 
alias="Footer Unsubscribe" target="_blank" style="color: #02488e; text-decoration: underline;" conversion="true">Unsubscribe</a>&nbsp; | &nbsp; 

On the Landing Page

SET @email=QueryParameter("email")
SET @email = Base64Decode(@email,"UTF-8")

if (v(@email) != "") then
Set @rows = LookupRows("CONTACTS_LIST_CA","EMAIL_ADDRESS_",@email)

/* We found one row of data */
if RowCount(@rows) == 1 then

/* Set the row - This now exposes all columns to our variable */
Set @row = Row(@rows,1)

/* Set the City */
var @fname
Set @fname = Field(@row,"FIRST_NAME")
Set @lname = Field(@row,"LAST_NAME")
Set @email = Field(@row,"EMAIL_ADDRESS_")

var email   = getParameterByName('email');  

if (email != "") {
$("#unsublink a").attr("href", "https://pages.e.client.ca/page.aspx?QS=2e4c31a3756cb940bb91a39ed91c9a007ed561eebe339901&email="+email+"&unsub=true");
if (unsub == "true") {
$("#EMAIL_ADDRESS_").prop("readonly", true);

What are we missing here? Any help is greatly appreciated!

  • 2
    The send context is already encoded in the encrypted string if you link to the landing pages properly (e.g. with micrositeURL() or cloudpagesURL()). – Adam Spriggs Dec 21 '17 at 19:28
  • I genuinely have no idea what that means... Is the suggestion to change %%=RedirectTo(Concat('pages.e.client.ca/… to %%=micrositeURL(Concat('pages.e.client.ca/… within the email? – George Rosedale Dec 21 '17 at 19:50

If you link to your page like this, all of the data points in your send context will be available automatically:

<a href="%%=redirectto(concat(CloudPagesURL(111),"&mid=", memberid))=%%">link</a>

(The 111 is the PageID of your CloudPage.)

Then in your page, you can retrieve the values by name with the AttributeValue() function:


var @emailAddress, @firstName
set @emailAddress = AttributeValue("emailaddr")
set @firstName = AttributeValue("firstName")

emailaddress: %%=v(@emailAddress)=%%
<br>firstName: %%=v(@firstName)=%%
| improve this answer | |
  • brilliant! Thank you Adam - you've done it again! – George Rosedale Dec 22 '17 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.