0

Below URL we are using as Un-subscription link in our Exact Target email template. It's working perfectly fine; until someone have "+" sign in Email then user sees an error page.

http://pages.abc.com/page.aspx?QS=12345&email=%%Email%%&corporation=%%Corporation%%&recordtype=%%RecordType%%

When I manually replace "+" sign with '%2b' in URL then it works.

Is there a way I can encode/decode or replace Emails with plus sign in URL? I tried URLEncode function but it did not work.

2 Answers 2

2

I'd opt for using the Base64 encode/decode functions, so you're not passing PII around in the URLs.

Email

%%[
SET @email = AttributeValue("Email")
SET @email = Base64Encode(@Email)
]%%
<a href="%%=RedirectTo(ConCat('http://example.com/page.aspx?QS=12345&e=',@email))=%%">link</a>

Landing Page

%%[
SET @email = QueryParameter("e")
set @email = Base64Decode(@Email,"UTF-8")
]%%
<br>Email: %%=v(@email)=%%

Reference

1

You can use Replace AmpScript function to replace emailaddress '+' sign to any other special characters something like below.

Email Code:

%%[
SET @Corporation = AttributeValue("Corporation")
SET @RecordType = AttributeValue("RecordType")
SET @Email = AttributeValue("Email")
SET @Email = Replace(@Email,'+','*')
]%%

<!DOCTYPE html>
<html>
<body>
<p><a href="%%=RedirectTo(ConCat('http://pages.abc.com/page.aspx?QS=12345&email=',@Email,'&corporation=',@Corporation,'&recordtype=',@RecordType))=%%">Unsubscribe</a></p>
</body>
</html>

LandingPage Code:

%%[
SET @Email = QueryParameter("email")
SET @Email = Replace(@Email,'*','+')
]%%

%%=v(@Email)=%%

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.