[原创]Thunderbird签名中含有图片发送失败的问题

前言

Thunderbird是一款优秀的电子邮件软件,功能多多。。。(这里跳过几万字的广告)。
近几日看到别人将精美的签名作为模板加入到邮件中,于是乎笔者也自己弄了一个HTML格式的签名。
可是将其嵌入邮件准备发送的时候,却被Thunderbird告知不能发送?!
又是一顿Google + Baidu + Bing 过后,终于找到了原因。写在这里供遇到同样问题的朋友参考。

问题的再现

1)做一个HTML签名文件
Sincerely, Super Cun Mu<p>
<a href="www.baidu.com">
   <img src="file:///C:/sign/baidu.gif" width="210px" height="100px"/>
</a><br />
<font color="#666666" face="Verdana, Arial, Helvetica, sans-serif" size="2">Me | Senior Applications Developer<br>Phone: <a href="tel:+86123456789">+86-123456789</a> |    Mobile: <a href="tel:+8613900000000">+86-1390000000000</a>
<br>
<a href="www.google.com">
   <img src="file:///C:/sign/google.png" width="210px" height="100px"/>
</a><br>
2)在IE中预览一下。

image

3)把它设置成为Thunderbird的签名。(不清楚的Google一下) [Account Settings] -> [Attach the signature from a file instead (text, HTML, or image)] -> [OK]
4)随便写一封信,发送,这个时候会报告不能发送“Sending of message failed.Attachment error.”

image

原因

原因在于Thunderbird将图片作为附件插入到邮件中的时候不能正常的解析HTML。国外的一些站点上说这是一个BUG,在Thunderbird9/10中被发现,笔者确认了一下,确实是这样。
  • Thunderbird 7.0 PASS
  • Thunderbird 9.0 NG
  • Thunderbird 10.0 NG

    解决方法

    经过笔者反复试验,发现两种方法可以解决上述问题。
    1)严格遵照W3C的标准去写HTML,去掉<img>标签两边的<a>标签。
    2)将图片放在一起。将上述代码稍加改动:
    Sincerely, Super Cun Mu<p>
    <a href="www.baidu.com">
       <img src="file:///C:/sign/baidu.gif" width="210px" height="100px"/>
    </a>
    <a href="www.google.com">
       <img src="file:///C:/sign/google.png" width="210px" height="100px"/>
    </a><br>
    <font color="#666666" face="Verdana, Arial, Helvetica, sans-serif" size="2">Me | Senior Applications Developer<br>Phone: <a href="tel:+86123456789">+86-123456789</a> |    Mobile: <a href="tel:+8613900000000">+86-1390000000000</a>
    <br>
    
  • 原文地址:https://www.cnblogs.com/hexin0614/p/2370273.html