mjmlio / mjml

MJML: the only framework that makes responsive-email easy
https://mjml.io
MIT License
17.08k stars 960 forks source link

mj-location doesn't work with variables #406

Closed pascalalich closed 8 years ago

pascalalich commented 8 years ago

First, thank you so much for having invented mjml. It's safes a lot of headache.

Given this code in my mjml though <mj-location address="{{var:address}}" />

the location component doesn't get rendered correctly.

The result is this:

<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
  <tbody>
    <table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="center" border="0">
      <tbody>
        <tr>
          <td>
            <a href="http://maps.google.com/maps?q=%7B%7Bvar%3Aaddress%7D%7D" target="_blank"><img alt="" title="" height="auto" src="http://i.imgur.com/DPCJHhy.png" style="border:none;border-radius:;display:block;outline:none;text-decoration:none;width:100%;height:auto;"></a>
          </td>
        </tr>
      </tbody>
    </table>
    <div style="cursor:auto;color:#000000;font-family:Roboto, sans-serif;font-size:18px;font-weight:500;line-height:22px;"><a href="http://maps.google.com/maps?q=%7B%7Bvar%3Aaddress%7D%7D" style="color:#3aa7ed;text-decoration:none;" target="_blank">{{var:address}}</a></div>
  </tbody>
</table>

While the link text is properly replaced by Mailjet afterwards, the variables in the URL aren't. But even if they are preserved, the question remains whether Mailjet would insert a URL encoded variant of the address. I am wondering how this could work or how a workaround could look like.

ngarnier commented 8 years ago

Hello @pascalalich, I'm trying to fully understand what is happening here.

Can you confirm that you are doing this in this order:

  1. Rendering the MJML template to HTML
  2. Sending through Mailjet using Mailjet's Templating Language to replace your variables

Here, it seems the address is not replaced (the URL generated is %7B%7Bvar%3Aaddress%7D%7D) by the API which would be an issue related to Mailjet's API rather than MJML.

Thanks!

ngarnier commented 8 years ago

Hello @pascalalich, do you have any news on this?

ngarnier commented 8 years ago

Hello @pascalalich, as I didn't hear back from you I'll close this issue. Feel free to reopen if you still have the issue.