.Net C# 发送带背景图html邮件(解决Outlook不显示背景图问题)

1、考虑兼容性问题,发送html邮件最好使用table tr td来布局,背景图使用

<td background="https://xqimg.imedao.com/1825f3baeeee1c73fd9dfb73.png!raw.jpg">

2、背景图为了兼容Outlook,使用VML(矢量可标记语言),条件注释判断Microsoft Outlook 版本

<!--[if(gte mso 9)|(IE)]>
<v:image xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style=" border: 0;display: inline-block; width: 688px; height: 1082px;" src="https://xqimg.imedao.com/1825f3baeeee1c73fd9dfb73.png!raw.jpg" />
             <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" 
             style=" border: 0;display: inline-block;position: absolute; width: 688px; 
             height: 1082px;">
             <v:fill  opacity="0%" color="#f7901e"  /><v:textbox inset="0,0,0,0"><![endif]-->
      <p>这里开始背景图片,邮件内容</p>       
<!--[if(gte mso 9)|(IE)]>
</v:textbox>
</v:fill>
</v:rect>
</v:image>
<![endif]-->

(二)示例背景图

在这里插入图片描述

(三)示例定义好的html邮件图

在这里插入图片描述

(四)html代码

<table border="0" cellpadding="0" cellspacing="0" width="688" height="1042">
    <tbody>
        <tr>
            <td background="https://xqimg.imedao.com/1825f3baeeee1c73fd9dfb73.png!raw.jpg" style="background-image: url(https://xqimg.imedao.com/1825f3baeeee1c73fd9dfb73.png!raw.jpg);">
                <!--[if(gte mso 9)|(IE)]><v:image xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" 
             style=" border: 0;display: inline-block; width: 688px; height: 1082px;" 
             src="https://xqimg.imedao.com/1825f3baeeee1c73fd9dfb73.png!raw.jpg" /><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" 
             style=" border: 0;display: inline-block;position: absolute; width: 688px; 
             height: 1082px;"><v:fill  opacity="0%" color="#f7901e"  /><v:textbox inset="0,0,0,0"><![endif]-->
                <table border="0" cellpadding="0" cellspacing="0" width="100%" height="90%" style="padding-left:40px;">
                    <tbody>
                        <tr>
                            <td style="line-height:240px;height:240px;"></td>
                        </tr>
                        <tr>
                            <td style="line-height:34px;height:34px">
                                <strong><span style="font-family:微软雅黑, Microsoft YaHei;font-size:16px">亲爱的@Name:</span></strong>
                            </td>
                        </tr>
                        <tr>
                            <td style="line-height:34px;height:34px;padding-top:0px;">
                                <span style="font-family:微软雅黑, Microsoft YaHei;font-size:16px">&nbsp;今天,&nbsp;</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="line-height:34px;height:34px">
                                <span style="font-family: 微软雅黑, &quot;Microsoft YaHei&quot;"><span style="font-size: 16px;"
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

下一秒_待续

如有帮到您,给个赞赏(^.^)

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值