HTML formatted email not showing up at all in Gmail but is in other mail clients

后端 未结 4 1375
栀梦
栀梦 2021-01-31 14:33

I\'m currently sending html formatted emails from PHP\'s mail() function and checking them simply to make sure they are showing up as HTML (formatting aside, I\'m well aware tha

相关标签:
4条回答
  • 2021-01-31 15:09

    The above answers are pretty good, just wanted to add a few more points. All credits to this link:

    1. Gmail only supports <style> in the <head>. Gmail does support embedded styles (<style>). However, embedded styles are only supported in the head of your HTML document. The Gmail Android and iOS apps does not support <style> at all when rendering emails retrieved through non-Google accounts (GANGA).

    2. Gmail removes your entire <style> block if it encounters an error.

    3. Gmail does not allow negative CSS margin values.

    4. Gmail does not support attribute selectors and most pseudo-classes. e.g. div[class="content"]{ color: red }. Gmail also does not support pseudo-classes like :checked and :active.

    0 讨论(0)
  • 2021-01-31 15:14

    I see you're using an ID named #footer. It seems that Google doesn't recognize that name when dealing with mails. Notice that in the font code seen from gmail, all your ID might appear with "exc" + idName, except #footer. Try to use a different name.

    0 讨论(0)
  • 2021-01-31 15:16

    GMail doesn't support <style> tags and neither does a number of clients. To make your life easier, you can use convert to convert your style tags to inline CSS: https://templates.mailchimp.com/resources/inline-css/

    0 讨论(0)
  • 2021-01-31 15:22

    I am updating my answer since it has quite a few views, and new tools are available. I am leaving my original answer for posterity.

    Edit * 9/19/19

    You can find CSS property support by email client here: https://www.caniemail.com/


    Original Answer:

    Gmail does not support the <style> tag. You need to use inline css for gmail to work correctly.

    Here's a reference list. http://www.campaignmonitor.com/css/

    0 讨论(0)
提交回复
热议问题