美文网首页
Email Template

Email Template

作者: Dino | 来源:发表于2019-01-04 22:44 被阅读3次

If there’s only one thing you to know about coding email, it’s that tables rule the day. Forget that old “separation of structure, presentation, and behavior” nonsense you learned in standards-based web design. Unlike modern web design the <table> element isn’t used just for tabular data, it’s all there is for consistent structure. External CSS doesn’t drive the styling, either; emails depend on inlined CSS.

Tables Within Tables

For finer control of your HTML, try nesting <table> elements when building emails. At its simplest, an email should be at least two tables deep:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title></title>
        <style></style>
    </head>
    <body>
        <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
            <tr>
                <td align="center" valign="top">
                    <table border="0" cellpadding="20" cellspacing="0" width="600" id="emailContainer">
                        <tr>
                            <td align="center" valign="top">
                                This is where my content goes.
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>
</html>

There’s a good reason; you must provide a table to serve as a redundant <body> element, as some email clients strip out the element when they render the email.

Code Responsively

<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
    <tr>
        <td align="center" valign="top">
            <table border="0" cellpadding="20" cellspacing="0" width="600" id="emailContainer">
                <tr>
                    <td align="center" valign="top">
                        <table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailHeader">
                            <tr>
                                <td align="center" valign="top">
                                    This is where my header content goes.
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="center" valign="top">
                        <table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailBody">
                            <tr>
                                <td align="center" valign="top">
                                    This is where my body content goes.
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="center" valign="top">
                        <table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailFooter">
                            <tr>
                                <td align="center" valign="top">
                                    This is where my footer content goes.
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

相关文章

  • Email Template

    If there’s only one thing you to know about coding email,...

  • Business email template

    Hello, Here are order details, For check and other instru...

  • Jenkins 常用插件

    Git Plugin Email Extension Template Role-Based Strategy B...

  • 2020-03-03 Email Template

    在发邮件时,我们有时候需要Add Tracking Link到我们指定的网页,当碰到这种需求事,我们可以参考以下的...

  • 即用即弃型邮箱

    python源码 使用示例: email = Email() 构造邮箱类 email = Email(proxy=...

  • GeekBand-STL 第1周

    template分类: class template,function template template在编译时...

  • 明道整合email 功能

    "Teamwork with email or without email, this is the questi...

  • DJANGO邮件配置中碰到的问题记录

    1、配置 EMAIL_HOST ='smtp.163.com' EMAIL_PORT ='25' # EMAIL_...

  • Email

    前言 Spring提供了JavaMailSender接口实现邮件发送。在Spring Boot的Starter模块...

  • email

    Email的历史比Web还要久远,直到现在,Email也是互联网上应用非常广泛的服务。几乎所有的编程语言都支持发送...

网友评论

      本文标题:Email Template

      本文链接:https://www.haomeiwen.com/subject/bbnloftx.html