I had this issue:

I have created a custom mail where I send a list of products. 
For this in my controller i concatenated a variable like this:

```
foreach (.....){
    $orderItems .= "<tr>
      <td>
        <p>" . $productSku . "</p>
        <p>" .  $differanceQty . "</p>                         
      </td>
    </tr>";
}

```

When I tried to send this variable from my controller to the email template in my email I received the HTML code instead of only the value.
So my custom email doesn't interpret my variable in the right way.

So I started looking for an answer and I didn't find anything related to this issue so that's why I posted this, maybe this will help someone.

the solution is to use the variable like this in the mail :

`{{var order}}` insead of `{{htmlescape var=$order}}`