phpmailer 不在 outlook 中显示图片
phpmailer not showing images in outlook
我正在使用 phpmailer 发送电子邮件,它包含许多图像,包括背景图像,它在 gmail 和 yahoo 上工作正常,但在 outlook 中它不显示图像,因为我的研究 outlook 不支持背景图像选项,所以有任何替代方案,但 outlook 也不显示图像。
$mail->Body = '
<div style="background: url(http://88.194.145.207:8882/p3-fi/bgimage.jpg); background-repeat: no-repeat; background-position: center; background-size: cover; background-color:blue;">
<div style="height:70px;">
</div>
<div style="background-image: url(http://88.194.145.207:8882/p3-fi/bgimage.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;"></div>
<table align="center">
<tr>
<td><img src="http://88.194.145.207:8882/p3-fi/logo.png" /></td>
</tr>
</table>
<div style="height:30px; "></div>
<div style="width:50%; height:200px; display:flex; margin:auto; background-color:gray; background-image: url(http://88.194.145.207:8882/p3-fi/image2.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<table align="center">
<tr>
<td><img src="http://88.194.145.207:8882/p3-fi/download.png" style="border-radius:100px; margin-top:30px;" /></td>
</tr>
</table>
</div>
<div style="width:50%; height:50px; margin:auto; background-color:gray; background-image: url(http://88.194.145.207:8882/p3-fi/image2.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<h3 style="color:white; text-align:center; margin:0px;"><a href="http://88.194.145.207:8882/p3-fi/'.$link.'" style="color:white; text-decoration:none;">DOWNLOAD FILE<a/></h3>
</div>
<div style="width:50%; margin:auto; background-color:white;">
<h3 style="margin:0px; padding-left:30px; padding-right:30px; padding-top:30px; Text-align:center;">'.$link2.'<br>Ready To download</h3>
<p style="padding:20px; text-align:center; margin:0px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In congue arcu a posuere mattis. Integer mollis eleifend lorem id sodales. Duis sollicitudin diam enim,</p>
</div>
<div style="width:50%; margin:auto; position:relative; text-align:center; background-color:white; height:100px; ">
<a href="http://88.194.145.207:8882/p3-fi/'.$link.'"><button style="background-color:#2C15D9; margin-top:25px; color:white; border-color:blue; border-radius:100px; width:150px; height:30px;"><b>GET NOW</b></button></a>
</div>
<div style="width:50%; margin:auto; background-color:white; display:flex;">
<table align="center" style="">
<tr style="margin:0px;">
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/facebook.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/twitter.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/instagram.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/youtube.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/google.png" style="width:20px; height:20px;"/></td>
</tr>
</table>
</div>
<div style="width:50%; margin:auto; background-color:white; height:50px;"> </div>
<div style="height:30px;"></div>
<p style="text-align:center; color:white;">@2018 P3 by CloudAssest <a href="#" style="color:white;"><u>Unsubscribe</u></a><p>
</div>
';
这是一个众所周知的问题:Outlook 不支持 CSS background-image
属性。除了防御性设计之外,我不知道有任何解决方法,这样背景图像的丢失不会对您的设计造成太大影响;例如,如果您在深色背景图像上使用浅色文本,也可以将背景颜色设置为深色,这样您就不会在白色背景上留下浅色文本。
您可以将背景作为嵌入图像添加到 PHPmailer 正文中
示例:
$mail->AddEmbeddedImage('img/background.jpg', 'bg');
并在标签上放置 src='cid:bg'
我正在使用 phpmailer 发送电子邮件,它包含许多图像,包括背景图像,它在 gmail 和 yahoo 上工作正常,但在 outlook 中它不显示图像,因为我的研究 outlook 不支持背景图像选项,所以有任何替代方案,但 outlook 也不显示图像。
$mail->Body = '
<div style="background: url(http://88.194.145.207:8882/p3-fi/bgimage.jpg); background-repeat: no-repeat; background-position: center; background-size: cover; background-color:blue;">
<div style="height:70px;">
</div>
<div style="background-image: url(http://88.194.145.207:8882/p3-fi/bgimage.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;"></div>
<table align="center">
<tr>
<td><img src="http://88.194.145.207:8882/p3-fi/logo.png" /></td>
</tr>
</table>
<div style="height:30px; "></div>
<div style="width:50%; height:200px; display:flex; margin:auto; background-color:gray; background-image: url(http://88.194.145.207:8882/p3-fi/image2.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<table align="center">
<tr>
<td><img src="http://88.194.145.207:8882/p3-fi/download.png" style="border-radius:100px; margin-top:30px;" /></td>
</tr>
</table>
</div>
<div style="width:50%; height:50px; margin:auto; background-color:gray; background-image: url(http://88.194.145.207:8882/p3-fi/image2.jpg); background-repeat: no-repeat; background-position: center; background-size: cover;">
<h3 style="color:white; text-align:center; margin:0px;"><a href="http://88.194.145.207:8882/p3-fi/'.$link.'" style="color:white; text-decoration:none;">DOWNLOAD FILE<a/></h3>
</div>
<div style="width:50%; margin:auto; background-color:white;">
<h3 style="margin:0px; padding-left:30px; padding-right:30px; padding-top:30px; Text-align:center;">'.$link2.'<br>Ready To download</h3>
<p style="padding:20px; text-align:center; margin:0px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In congue arcu a posuere mattis. Integer mollis eleifend lorem id sodales. Duis sollicitudin diam enim,</p>
</div>
<div style="width:50%; margin:auto; position:relative; text-align:center; background-color:white; height:100px; ">
<a href="http://88.194.145.207:8882/p3-fi/'.$link.'"><button style="background-color:#2C15D9; margin-top:25px; color:white; border-color:blue; border-radius:100px; width:150px; height:30px;"><b>GET NOW</b></button></a>
</div>
<div style="width:50%; margin:auto; background-color:white; display:flex;">
<table align="center" style="">
<tr style="margin:0px;">
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/facebook.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/twitter.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/instagram.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/youtube.png" style="width:20px; height:20px;"/></td>
<td style="padding:10px;"><img src="http://88.194.145.207:8882/p3-fi/google.png" style="width:20px; height:20px;"/></td>
</tr>
</table>
</div>
<div style="width:50%; margin:auto; background-color:white; height:50px;"> </div>
<div style="height:30px;"></div>
<p style="text-align:center; color:white;">@2018 P3 by CloudAssest <a href="#" style="color:white;"><u>Unsubscribe</u></a><p>
</div>
';
这是一个众所周知的问题:Outlook 不支持 CSS background-image
属性。除了防御性设计之外,我不知道有任何解决方法,这样背景图像的丢失不会对您的设计造成太大影响;例如,如果您在深色背景图像上使用浅色文本,也可以将背景颜色设置为深色,这样您就不会在白色背景上留下浅色文本。
您可以将背景作为嵌入图像添加到 PHPmailer 正文中
示例:
$mail->AddEmbeddedImage('img/background.jpg', 'bg');
并在标签上放置 src='cid:bg'