3

To create a unique URL for our customers in an email (to review our services on another website) I will need to use the BASE64 version of the person's email address and append that to the URL as a query string.

For example https://www.trustpilot.com/evaluate/www.kaplaninternational.com?b=%%emailaddress%%

so using my email address (sbi85g@gmail.com) that would be this: https://www.trustpilot.com/evaluate/www.kaplaninternational.com?b=c2JpODVnQGdtYWlsLmNvbQ==

Of course I can't use online Base64 calculators since this email would go out to a lot of people in an automated fashion.

So the question is... Is it possible to build up an AMPscript that would do this conversion?

I looked around and haven't found any clue how the conversion is happening. If we would know that (or you might already do), we just need to replicate the calculation steps with AMPscript, I reckon.

What do you think?

edit: actually I found how roughly the calculation is happening:

Base64 encoding takes three bytes, each consisting of eight bits, and represents them as four printable characters in the ASCII standard. It does that in essentially two steps.

Rest is here: http://email.about.com/cs/standards/a/base64_encoding.htm

2

Balint, I think the following block of code should accomplish your goal by using the Base64Encode function of AMPscript (https://code.exacttarget.com/content-scripting/ampscript/encryption/Base64Encode.html)

%%[
SET @email = 'sbi85g@gmail.com'
SET @email64 = Base64Encode(@email)
SET @url = Concat('https://www.trustpilot.com/evaluate/www.kaplaninternational.com?b=', @email64)
]%%

<a href='%%=RedirectTo(@url)=%%'>Your Link</a>
1
  • oh there is actually a function for this already? thats brilliant. wow thanks a lot Brandt, that helped a lot.
    – Balint
    Aug 22 '14 at 13:53
0

I'm trying to encode an image path and the image doesn't show up in email. When I check the source code, instead of the proper image path, is just gibberish. Am I doing anything wrong? Thanks.

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.