CMS Development

SStrachan
Participant

Parsing Error Sending email

I thought a 3 min video would show this issue best.

https://capture.dropbox.com/dATzBGZBYgYkKfbd

 

Please help. Here is the code that causes the email to fail.

 

<!-- This works -->
<h3>
  {{ broker_one.mobilephone }}<br>
  {{ broker_one.mobilephone|regex_replace("[^0-9]|\\s", "") }}
  <br><br>
  {{ broker_two.mobilephone }}<br>
  {{ broker_two.mobilephone|regex_replace("[^0-9]|\\s", "") }}
</h3>
<!-- This Fails -->
Broker ONE<br>
<a href="tel:{{ broker_one.mobilephone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> CALL: {{ broker_one.mobilephone }}</a><br>
<a href="https://wa.me/{{ broker_one.mobilephone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> WHATSAPP </a>
<br><br>
Broker TWO<br>
<a href="tel:{{ broker_two.mobilephone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> CALL: {{ broker_two.mobilephone }}</a><br>
<a href="https://wa.me/{{ broker_two.mobilephone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> WHATSAPP </a>

 

 

0 Upvotes
2 Replies 2
lindahl
Contributor | Diamond Partner
Contributor | Diamond Partner

Parsing Error Sending email

Hi there, I tested your code on my side, it seems like it's working, yup! it works.

 

Would you like to create a new test email with existing template just to make sure it works?

 

Please take a look at my loom here: https://www.loom.com/share/246c547fd1584de693815715adb83763

 

Just to make everything clarified, I used the following:

  • Create a custom email template with programmable email feature turned on
  • Include an email module inside the template
  • Regardless of using variable or not it both works

In the beginning it's not working because I tried to create the module and use it in Drag N' Drop email template, I changed to Custom email template later on, and find it in the beginning it doesn't work, I was guessing maybe because I missed something out, so I created another new email with the same template (sometimes you need to publish or save it twice for Design Manager to work or clear the full cache of the page just to make sure), this time it works. 

 

I did double check on your code and I do not see any reason why it will not work, I was guessing maybe personalized variable is not available in the beginning (At least in Drag N Drop, it seems like it doesn't work).

 

So I think it should be ok just need to double check or recreate a new email just to scratch other issue out?

 

This is my code for your reference:

 

<div style="background: skyblue; padding: 10px;">
<!-- This works -->
<h2>
  My Test
</h2>

<h3>
  {% set phone_number = contact.phone %}
  <span style="color: blue;">{{ phone_number }}</span><br>
 <span style="color: red;"> {{ phone_number|regex_replace("[^0-9]|\\s", "") }}</span>
</h3>
    
<a href="tel:{{ phone_number|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> CALL: {{ phone_number }}</a><br>
<a href="https://wa.me/{{ phone_number|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> WHATSAPP </a>
</div>

<div style="background: gray; padding: 10px;">
  <h2>
  This is your code
</h2>
    
<!-- This works -->
<h3>
  {{ contact.phone }}<br>
  {{ contact.phone|regex_replace("[^0-9]|\\s", "") }}
  <br><br>
  {{ contact.phone }}<br>
  {{ contact.phone|regex_replace("[^0-9]|\\s", "") }}
</h3>
<!-- This Fails -->
Broker ONE<br>
<a href="tel:{{ contact.phone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> CALL: {{ contact.phone }}</a><br>
<a href="https://wa.me/{{ contact.phone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> WHATSAPP </a>
<br><br>
Broker TWO<br>
<a href="tel:{{ contact.phone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> CALL: {{ contact.phone }}</a><br>
<a href="https://wa.me/{{ contact.phone|regex_replace("[^0-9]|\\s", "") }}" target="_blank"> WHATSAPP </a>
    
</div>
    

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Parsing Error Sending email

@Gonzalo , any thoughts on this one? 

Maybe try setting a variable above with your regex filter and then adding the new variable in the href?

Might check your console as well to see if you get all of the error

 

0 Upvotes