邮件该如何发送html代码

主宰稳场 提交于 2019-12-08 00:50:08

1.html嵌入到第三方邮件系统中,很多h5标签、css3不支持。布局采用table+css。tabel表兼容性最好。css才用行内 可进行 tabel中嵌套div。例如:

<table width="600" border="0" cellspacing="0" cellpadding="0" style="font-family:'微软雅黑',Helvetica,Arial,sans-serif;font-size:14px " width="100%">
     <tbody>
                <tr>
                    <td style="font-family:Helvetica,Arial,sans-serif;font-size:14px;">
                    <table width="100%" border="0" cellpadding="5" cellspacing="0" >
                            <tbody>
                                <tr>
                                    <td>
                                        <p style="margin:0;font-size:14px;line-height:24px;margin-bottom: 20px">
                          尊敬的开发者:
                        </p>
                                        <p style="color:#000;margin:0;font-size:14px;line-height:24px;">
                         “xxx”在此次的‘网络友好度测试’评级:<span style="color:#F44336;">4颗星</span>(最高5颗星)。
                        </p>
                                    </td>
                                </tr>
                            </tbody>
                    </table>                                                          
                   </td>
              </tr>
                
   </tbody>
</table>

2. 不能用浮动的方式定位。position:absolute;float:left;等都不行,float在qq邮箱客户端中可以识别,但是在outlook中无法识别。

3. 为了保证兼容性,需要把邮件的宽度设置为600px,最大600px;

4. 少用img,因为很多邮箱客户端默认不显示图片,所以,如果需要图片的话,一定要写好alt和title;

5. 背景图片,尽量用background-color使用纯色背景,如果一定要用背景图片,使用background属性,

<div background=”http://image1.koubei.com/images/common/logo_koubei.gif”></div>

6. 邮件不支持javascript,link,flash、ifrome以及一些特殊的标签

7.邮件在PC端能能够分辨出style标签,但在移动端是不支持的。故:行内写移动端样式,style中样式做PC端移动端兼容。

8.针对outlook,代码压缩时 <!--[if gte mso 9]>...<![endif]-->

当发送html时,可以在head便签中
<style>
.outlook{display:none}
</style>
<!--[if gte mso 9]>
	<style type="text/css">
	    .normal{display:none;}
        .normal a{display:none !important;}
	    .outlook{display:block !important;}
	</style>
<![endif]-->

9、outlook中,图片首次加载如果图片加载不出,会默认占位子

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!