Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent escaping mailchimp variables #30

Open
vladkucherov opened this issue Apr 2, 2014 · 5 comments
Open

prevent escaping mailchimp variables #30

vladkucherov opened this issue Apr 2, 2014 · 5 comments
Labels

Comments

@vladkucherov
Copy link

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?

@christiaan
Copy link
Owner

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?

@vladkucherov
Copy link
Author

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.

@ambroisemaupate
Copy link

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.

@christiaan
Copy link
Owner

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.

@staceypee
Copy link

Hello! Sorry to inject myself into a years-old conversation. Hoping that someone has since solved this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants