使用PHP邮件功能时,邮件不会在Outlook中显示图像

时间:2012-08-09 08:48:34

标签: php

当我使用PHP的mail功能发送电子邮件时,它适用于Yahoo和GMail帐户,但在Outlook 2007中,邮件中使用的图像和背景图像不会显示。

我怎样才能让它适用于Outlook呢?

我的代码:

<?php

// multiple recipients (note the commas)
$to = "zohaib@sikone.com, ";

// subject
$subject = "Eid Card";

// compose message
$message = '
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Fillon soutient à fond le retour d\'un Grand Prix de France</title>
</head>
<body>
   <p>Le Premier ministre François Fillon, passionné d\'automobile et pilote à ses heures, a apporté un soutien appuyé au retour d\'un Grand Prix de France au calendrier 2013 de la Formule 1, en faisant un passage-éclair vendredi sur le circuit Paul Ricard dans le Var.</p>
      <img src="http://marvelconcepts.net/email%20of%20eidcard/01.jpg" width="500" height="498">
      <div style=" background-image:url(http://marvelconcepts.net/email%20of%20eidcard/01.jpg); width:100px; height:200px; font-size:16px;">
   <p>Le Premier ministre François Fillon, passionné d\'automobile et pilote à ses heures, a apporté un soutien appuyé au retour d\'un Grand Prix de France au calendrier 2013 de la Formule 1, en faisant un passage-éclair vendredi sur le circuit Paul Ricard dans le Var.</p> </div>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = "From: Eid Card<info@izhar.com>\r\n";
$headers .= "Reply-To: info@izhar.com\r\n";
$headers .= "Return-Path: info@eizhar.com\r\n";
$headers .= "X-Mailer: Drupal\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
// send email
mail($to, $subject, $message, $headers);
?>

2 个答案:

答案 0 :(得分:1)

outlook电子邮件客户端不支持html格式的电子邮件中的背景图像。还有很多其他的html和css,以及其他电子邮件客户端也不支持。最好的支持列表是CSS Support The Ultimate Guide

答案 1 :(得分:0)