<blockquote>
  <p>Is there no way to have separate templates for text and html emails in craft?</p>
</blockquote>

<p>Correct.  That's something we're going to try to address in Craft 3.</p>

<p>Regarding the ampersand encoding, I can't reproduce that locally.  Maybe your email client is encoding it or there is an overly aggressive <a href="https://www.modsecurity.org/" rel="nofollow">mod_security</a> / <a href="https://suhosin.org" rel="nofollow">Suhosin</a> / Apache setting that's doing it?</p>

CC BY-SA 3.0
2015-12-09T20:49:33.640Z
If there's any way you can move up giving email template capabilities some love...I have a membership site where every interaction - member activation, reset password, etc - by email requires copying and pasting a link.
Mark J. Reeves
CC BY-SA 3.0
2018-01-23T00:11:49.030Z
I'm having this issue with 2 out 96 users (so far). Is {{link|escape}} the recommended workaround?
Andrea DeMers
CC BY-SA 4.0
2021-10-26T12:29:38.963Z
We're using Craft 3 and have a client with the same issue. At present, their customers are having to copy and paste the link to avoid the 'Bad Request' message. Is there a solution to this?
GazCrane
CC BY-SA 3.0
2015-07-03T20:59:53.863Z
2015-07-03T20:59:53.863Z
Brad Bell
<p>We have a problem related to the escaping of the <code>&amp;</code> in the password reset URL not being escaped. This link:</p>

<pre><code>http://yoursite/admin/actions/users/setpassword?code=abcd&amp;id=1234
</code></pre>

<p>somehow, this arrives at our server as: </p>

<pre><code>http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;id=1234
</code></pre>

<p>Then the code is <code>abcd</code> and a parameter called <code>amp;id</code> is <code>1234</code>, and the error "Bad Request Param "id" doesn't exist." is thrown.</p>

<p>In our case, we have craft setup to send HTML emails, and have an email template like: </p>

<pre><code>Click here to reset your password: {{link}}
</code></pre>

<p>and end up with the link <code>http://yoursite/admin/actions/users/setpassword?code=abcd&amp;id=1234</code> directly in the HTML - this is <em>WRONG</em>, since the <code>&amp;</code> symbol has to be escaped as <code>&amp;amp;</code>. </p>

<p>Now, we could compensate, and make our template: </p>

<pre><code>Click here to reset: {{link|escape}}
</code></pre>

<p>Then we get correct HTML, but the plain-text version of the email is now broken. </p>

<p>Is there no way to have separate templates for text and html emails in craft? </p>

<p>How do other people solve this?</p>

<emails><escape><html-entities>
How to encode links in email templates?
# How to encode links in email templates?

(Asked by: username_0 on 2015-04-27)

We have a problem related to the escaping of the & in the password reset URL not being escaped. This link:
http://yoursite/admin/actions/users/setpassword?code=abcd&id=1234

somehow, this arrives at our server as: 
http://yoursite/admin/actions/users/setpassword?code=abcd&id=1234

Then the code is abcd and a parameter called amp;id is 1234, and the error "Bad Request Param "id" doesn't exist." is thrown.
In our case, we have craft setup to send HTML emails, and have an email template like: 
Click here to reset your password: {{link}}

and end up with the link http://yoursite/admin/actions/users/setpassword?code=abcd&id=1234 directly in the HTML - this is WRONG, since the & symbol has to be escaped as &. 
Now, we could compensate, and make our template: 
Click here to reset: {{link|escape}}

Then we get correct HTML, but the plain-text version of the email is now broken. 
Is there no way to have separate templates for text and html emails in craft? 
How do other people solve this?

**Tags:** emails, escape, html-entities

---

## 1 answers

### Answer by username_1 on 2015-07-03. Score: 1 | Accepted answer

> Is there no way to have separate templates for text and html emails in craft?

Correct. That's something we're going to try to address in Craft 3.

Regarding the ampersand encoding, I can't reproduce that locally. Maybe your email client is encoding it or there is an overly aggressive [mod\_security](https://www.modsecurity.org/) / [Suhosin](https://suhosin.org) / Apache setting that's doing it?

> **Comments:**
> **username_2**: If there's any way you can move up giving email template capabilities some love...I have a membership site where every interaction - member activation, reset password, etc - by email requires copying and pasting a link.  
> **username_3**: I'm having this issue with 2 out 96 users (so far). Is {{link|escape}} the recommended workaround?  
> **username_4**: We're using Craft 3 and have a client with the same issue. At present, their customers are having to copy and paste the link to avoid the 'Bad Request' message. Is there a solution to this?  

---

