InlineStyle
InlineStyle copied to clipboard
prevent escaping mailchimp variables
Hello there,
it looks like if you use variables inside quotes, they get escaped. for example:
<a href="mailto:*|EMAIL|*">*|EMAIL|*</a>
The result would be:
<a href="mailto:*%7CEMAIL%7C*>[email protected]</a>
Any ideas on how to make it ignore specific chars inside quotes?
I think this is a DOMDocument problem. Can you reproduce this issue when you load the HTML into DOMDocument and then have it output HTML again?
Yes, this is the case. apparently, DOMDocument tries to "fix" HTML attributes and reformat the data. I couldn't find a way to force him ignore the contents of attribute.
The only solution I found is to run over the output and replace back the escaped data - not good practice...
Also... for those who will get the same issue with Mailchimp / Mandrill, they provide an inliner of there own. just set "inline_css":true
to your request.
Hi there.
I have the same suggestion using Mailjet variables like [[PERMALINK]]
or [[UNSUB_LINK_FR]]
.
But MailJet is not as smart as MailChimp and does not inline styles for you.
You could use preg_replace_callback to replace all those instances with unique strings that are not escaped. Then after inlining replace them back.
I've marked it as a feature but I'm not so sure it is within the scope of this project. However I see this is a recurring problem for the intended usecase.
When you do get this working using the suggested substitute replace method described I would be happy to either include or link to your solution.
Hello! Sorry to inject myself into a years-old conversation. Hoping that someone has since solved this?