10

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

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
user30772
  • 166
  • 1
  • 2
  • 9
  • 2
    I have the same issue, Gmail is deleteing all CSS styles in the `` of the html document I attach to mails. And note, I have no JS in document at all, only pure HTML and CSS styles in the ``. I start to think more and more that Gmail is just junk! – Marco Demaio Oct 19 '12 at 10:55

2 Answers2

4

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?.

Community
  • 1
  • 1
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
3

One way around this would be to have your script simply host the HTML file somewhere, and email a link to that file.

I cannot find any documentation from Google or the GMail team, but I would be surprised if they allowed HTML attachments to be opened and viewed (this would be a security risk, since they would essentially allow their email servers to host user-generated web content).

  • What get's me is that gmail will open word doc's and pdf's in this exact same way or by wrapping them in html (which seems like a slop that's equally as slippery), but I see what your saying. – user30772 Jun 05 '12 at 20:55