This seemed to me like this would be a fairly easy thing to do. Trying to be able to pass an email address as a URL parameter in an email template. I thought, great URLENCODE() will do that no problem, easy as pie. I'm running into an issue where it seems that URLENCODE() is only working with TEXT email template. When I try to use it in an HTML template, it just does nothing.

Let me also mention that I know there are workarounds such as using SUBSTITUTE, or a VF template or using APEX to generate the properly encoded link. I am trying to do this natively so its easily updated and maintained by a non technical client.

Here is what I mean. Lets pretend this the link I want to generate and send out in an email template

https://[email protected]

I would normally do something like this with URLENCODE


If I do this in a TEXT based email template, it encodes it as expected and it works and shows in the email like below


If I use the same method in an HTML template, it just leaves out the email altogether


So, am I crazy? Does URLENCODE just not work with HTML templates, or is there a caveat and a way you need to use them to get them to work with HTML templates? Anyone else run into this and figured it out. I've done some research and can't find anything on this specifically.

I found this post by Andy Fawcett, where he says it will work with TEXT based templates, but It doesn't exclusively say it DOESN'T work with HTML. Does it just not work?

1 Answer 1


It still works if you use copy text from HTML version on these templates .Salesforce sends a “multi-part MIME” email, including both an HTML and text-only version of your email for email clients that cannot read HTML emails.

enter image description here

enter image description here

And then when i test preview the email in my Inbox it renders well

enter image description here

  • But the point is that still only works for text based emails. It doesn't work for HTML templates. I have tested many times to confirm. Your example is showing the text version of an HTML template. Aug 14, 2016 at 13:37
  • @ChrisDuncombe Let me check back once more . I assume that when we have both HTML and TEXT version ,browser supporting HTML is rendered . Aug 14, 2016 at 13:45
  • @ChrisDuncombe I verified and it does work without any text as well .Please double check and the screenshot is HTML version of it not Text . Aug 14, 2016 at 13:59
  • I honestly don't know what went on, but it seems to be working now. Maybe it was user error, maybe it was just acting weird that day, but it seems to be working now. Sorry for the troubles Aug 28, 2016 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .