Dave
Dave

Reputation: 29141

Mandrill strips "style" attribute on links

UPDATE: Mandrill isn't doing it, Gmail is.


Original question:

I'm using Mandrill to send Emails via SMTP. I have all my HTML with inline CSS.

My links, however, don't retain their inline "style" attribute. They lose the attribute and gain a target="_blank".

I understand the addition of the "target" attribute, but why/what is stripping out my style attribute, and how can I keep it from happening?

I've turned off the settings I thought might mess with it, but - it's still happening. Can I stop this from happening, or is there a way around it?

My pertinent Mandrill settings:

Mandrill settings

Upvotes: 1

Views: 1410

Answers (2)

Dave
Dave

Reputation: 29141

So, it turns out, it's not Mandrill that's stripping the style attribute, it's Gmail. When I "Show original", it shows my styles there.

I'll do some research on how to keep Gmail from doing it, and will either ask a new StackOverflow question if search comes up empty, or post the answer here.

Update: There was a MINOR issue w/ my CSS that Google didn't like, so it removed the entire style attribute. Lesson learned - make sure your CSS is flawless or Google will SMASH it. :)

Upvotes: 4

Ian Bytchek
Ian Bytchek

Reputation: 9085

Obviously if you see target="_blank" being added this is a good indicator that Mandrill is making that check and not putting back together everything it should. I'd raise this with their support or send a bug request.

On the other side, you can embed the link styles in <head>, some clients will probably not like it, but most will be fine with it. As an experiment, in addition to that you can also select the "inline" option, and see if Mandrill would inline them as expected. I know inlining them every time is a bad idea and impacts the performance, but at least that might be a temporary solution until the Mandrill team gets back.

Upvotes: 0

Related Questions