简体   繁体   English

使用GMail发送HTML电子邮件时遇到问题

[英]Trouble with sending an HTML email with GMail

I'm creating an HTML email for a client to send for follow ups with links to places his clients can leave reviews for his Realty service. 我正在创建一个HTML电子邮件供客户发送,以进行后续操作,并提供指向其客户可以留下有关其Realty服务的评论的地方的链接。

I'm having an issue with the formatting. 我在格式化方面遇到问题。 I'm using a Chrome plugin, HTML Inserter for Gmail , and after pasting the code in to the email it looks correct in the composed message. 我使用的是Chrome插件, 用于Gmail的HTML插入器 ,并将代码粘贴到电子邮件中后,它在撰写的邮件中看起来是正确的。 However, when I send a test email to myself, it is not formatted correctly. 但是,当我向自己发送测试电子邮件时,其格式不正确。

The HTML uses tags approved by Gmail's Whitelist , and style in the head is supported according to the Gmail docs . HTML使用经Gmail 白名单批准的标签,并且根据Gmail文档支持头部的样式。 The style character count is well under Gmail's max of a little over 8000 characters. 在Gmail最多不超过8000个字符的情况下,样式字符数是可以接受的。

After doing some research on here I'm not able to find anything wrong with my code. 在这里进行了一些研究之后,我的代码找不到任何错误。

This is my first time asking a question on Stack Overflow so I'm not sure if it's common for people to paste their entire code to the question? 这是我第一次问有关堆栈溢出的问题,所以我不确定人们是否将整个代码粘贴到该问题上是否很普遍? I've added the document to a Repl.it found here . 我已将文档添加到此处的Repl.it中。

Apologies if this is a simple fix - I wasn't able to find anything online to help. 抱歉,这是一个简单的解决方法-我无法在线找到任何帮助。 Thank you! 谢谢!

Matthew, 马修,

I looked into the HTML inserter for gmail and it appears that after the last update to the plugin this is a common issue that people are having. 我调查了gmail的HTML插入程序,看来在上次对该插件进行更新之后,这是人们经常遇到的问题。 Is it possible that it is the plugin and not your code? 可能是插件而不是您的代码吗?

I didn't know this google whitelist, or the google documentation about it but I realised multiple html emails, and gmail is just a client among others. 我不知道这个Google白名单,也不知道有关它的Google文档,但是我意识到有多个HTML电子邮件,而gmail只是其中的一个客户。 And usualy it's more permissive than other like Outlook for exemple (I think it's the worst). 通常,它比其他示例(例如Outlook)更宽松(我认为这是最糟糕的)。 If the purpose is for your client to send it to his client, you have to take in consideration there is multiple client with multiple render motor, because maybe one of his client will open it with Outlook or Thunderbird. 如果目的是让您的客户将其发送给他的客户,则必须考虑到有多个具有多个渲染马达的客户,因为也许他的一位客户会使用Outlook或Thunderbird打开它。

And here comes the sad part... If you want a full support on the different mail clients, it's like back in the old web. 令人难过的是,如果您想在不同的邮件客户端上获得全面支持,就像回到旧网络一样。 It's usualy something like this exemple from an old mail I send to get an internship: 通常是这样的一个例子,例如我寄给我以获得实习机会的一封旧邮件:

<table style="border-collapse:collapse;width:500px;margin:0 auto">

    <tbody>
        <tr>

            <td>
                <img src="https://ci5.googleusercontent.com/proxy/rZJ68vGa_16qkkvRQ7gpG698xHm2qHxDGps3vTpHjqeN8hHjI6J9pqXpARCuzjb3XYsnCviGiLUBV8RQhvAxO2ZIdIPhrA=s0-d-e1-ft#http://boursbenjamin.be/_imgmail/superstrong.png"
                    alt="header" width="500" height="300" style="display:block" class="CToWUd">
            </td>

        </tr>

        <tr style="font-family:roboto,sans-serif;font-size:16px;line-height:20px">

            <td style="padding:40px 30px 40px 30px;background:#ffffff">
                <table style="width:100%">
                    <tbody>
                        <tr>
                            <td>
                                Je suis
                                <b style="color:#00bbfd">Benjamin Bours</b>,
                            </td>
                        </tr>
                        <tr>
                            <td style="padding:40px 0px 40px 0px">
                                je proviens de Liège et
                                <b style="color:#00bbfd">j'étudie à l'HEAJ de Namur</b> ou j'apprends le
                                <b style="color:#00bbfd">webdesign</b> et le
                                <b style="color:#00bbfd">front end development.</b>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding:0px 0px 40px 0px">
                                Dans le cadre de ma dernière année, je dois réaliser un
                                <b style="color:#00bbfd">stage de 3 mois</b> (du 7 Novembre au 27 Janvier).
                            </td>
                        </tr>
                        <tr>
                            <td style="padding:0px 0px 40px 0px">
                                J'aimerais vraiment
                                <b style="color:#00bbfd">améliorer</b> mes compétences de développement et
                                <b style="color:#00bbfd">travailler</b> sur des
                                <b style="color:#00bbfd">projets avec vous</b>, et c'est pourquoi je pense que vous,
                                <b>
                                    <span class="il">SUPERSTRONG</span>
                                </b>, êtes
                                <b style="color:#00bbfd">l'agence parfaite pour moi.</b>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Si vous désirez en savoir plus sur moi, je vous invite à
                            </td>
                        </tr>
                        <tr>
                            <td style="padding:80px 0px 80px 0px">
                                <div style="width:200px;height:100px;border:solid #00bbfd 3px;margin:0 auto">
                                    <a href="http://boursbenjamin.be" style="display:block;text-align:center;text-decoration:none;color:#00bbfd;box-sizing:border-box;margin:0 auto;width:200px;line-height:100px;font-weight:600"
                                        target="_blank" data-saferedirecturl="https://www.google.com/url?q=http://boursbenjamin.be&amp;source=gmail&amp;ust=1534023364151000&amp;usg=AFQjCNEltkO1A2HaWdPFPTkNbFw3PhHfrQ">Visiter mon site</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding:0px 0px 40px 0px">
                                Dans l'attente de votre réponse.
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Je vous prie de bien vouloir agréer, mes sincères salutations, Benjamin Bours.
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>

        </tr>

    </tbody>
</table>

Here, some interesting links about it 在这里,一些有趣的链接

https://litmus.com/help/email-clients/rendering-engines/ https://litmus.com/help/email-clients/rendering-engines/

https://caniuse.email/ https://caniuse.email/

https://www.nurturehq.com/tips/why-html-email-can-be-a-pain https://www.nurturehq.com/tips/why-html-email-can-be-a-pain

https://medium.com/connect-the-dots/10-steps-for-effective-cross-client-browser-html-emails-e69a78da1b13 https://medium.com/connect-the-dots/10-steps-for-effective-cross-client-browser-html-emails-e69a78da1b13

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM