Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to attach html file so that gmail's "view" option works

I have a script that sends an email with an html attachment. When I select "view" in gmail I get text...however when I click on "download" instead of "view", then open it, it displays as it should.

I think it's gmail related because I observe the exact same behavior from IE, FireFox(win/linux), Chrome(win/linux)

I made a youtube video of here: http://www.youtube.com/watch?v=WkGyxcFQXS8

Am I doing something wrong?

Thanks

like image 708
user30772 Avatar asked Jun 05 '12 18:06

user30772


People also ask

Can you embed HTML in Gmail?

Copy & Paste HTML into Gmail If you write HTML code in an editor and then simply copy and paste it in the Compose window on Gmail, you will get back straight code. That's because that window relies on the WYSIWYG editor, as mentioned above.

Why is my Attach file button not working in Gmail?

It's possible that one of your browser extensions is limiting the functionality of Gmail. Another reason why you can't attach files in Gmail is that your browser does not support the email service. If you want to access the best experience, opt for supported browsers like Edge, Chrome, Safari, and Firefox.


1 Answers

Not all email clients support the <style> tag. Gmail is one of those; it only respects in-line styling.

If your code is producing the css & html, then you could change it to use in-line styles for the table.

If you want something more auto-magic, see How do I use Google Apps Script to change a CSS page to one with inline styles?.

like image 89
Mogsdad Avatar answered Sep 28 '22 14:09

Mogsdad