【问题标题】:HTML Template in Gmail Renders IncorrectGmail 中的 HTML 模板呈现不正确
【发布时间】:2020-12-07 18:49:59
【问题描述】:

我正在使用 Mailgun 从模板发送邮件。但在 Gmail 上呈现不正确。

我没有使用任何样式标签或任何复杂的 css。

ps:我不确定我应该添加多少文字才能被接受。

这里是html模板

模板:

<html xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0;">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Communication</title>
</head>
<body style="margin:0;padding:0;">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td align="center" valign="top" bgcolor="#fff" style="background-color:#fff;">
                <table width="600" border="0" cellspacing="0" cellpadding="0" style="border: solid 1px #000;margin-top:60px;">
                    <tr>
                        <td align="left" valign="top" bgcolor="#001529" style="background-color:#001529; font-family:Arial, Helvetica, sans-serif; padding:10px;">
                            <div style="font-size:36px; color:#fff;">
                                <b>FORGOT YOUR PASSWORD?</b>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" bgcolor="#fff" style="background-color:#fff;">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="left" valign="middle" style="color:#525252; font-family:Arial, Helvetica, sans-serif; padding:10px;">
                                        <div style="font-size:16px;">
                                            Dear {0},
                                        </div>
                                        <div style="font-size:16px;">
                                            <p>A request has been received to reset your password for your -- account. Please click the button below to reset your password.</p>
                                            <center>
                                                <button type="button" title="Confirm Account Registration" style="background: #00415a;border:1px solid #00415a;">
                                                    <a href="{1}" style="font-size:22px; padding: 6px 12px; color: #f2faff;text-decoration:none;display:inline-block">
                                                        Reset Password Now
                                                    </a>
                                                </button>

                                            </center>
                                            <p style="font-size:16px;">If you did not make this request please igonore this email.</p>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="left" valign="middle" style="padding:15px; background-color:#00415a; font-family:Arial, Helvetica,sans-serif;font-size:12px; color:#f2faff;">
                                        <p>Regards<br/>
                                        -- © {2}</p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>   

这是它在 Gmail 中的呈现方式:

Gmail:

【问题讨论】:

    标签: html css email gmail


    【解决方案1】:

    给标题和按钮文本一个行高,并且应该修复它。

    我还建议不要在电子邮件/表格中使用顶部边距或底部边距,但始终使用填充来代替。由于某种原因更兼容。例如,如果您需要在上方留出一些空间,请在元素上方创建一个空 div 并为其指定高度。

    【讨论】:

    • 谢谢,主要问题是有多余的空白。检查 gmail 上的代码时,似乎在源代码中找不到额外的 'tr' 和 'br' 元素
    【解决方案2】:

    缩小模板似乎可以解决问题。

    请记住,这不是 Gmail 问题,而是 Mailgun 问题。

    【讨论】:

      猜你喜欢
      • 2011-09-01
      • 1970-01-01
      • 2014-04-23
      • 1970-01-01
      • 1970-01-01
      • 2019-09-13
      • 2022-01-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多