使用PHP邮件代码发送IMAGE时出错

时间:2014-02-12 07:55:10

标签: php image email inline

每当我尝试借助外部PHP代码从HTML页面发送IMAGE时,IMAGE以纯文本形式发送......

请帮忙......

PHP代码:`

$headers .= "MIME-Version: 1.0 \n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1 \n"; 


$headers .= "from:".$_POST['gallery_form_name']."<".$_POST['gallery_form_email'].">"; 
$mail_body = "<table cellpadding='0' cellspacing='0' border='0'><tr><td>First Name : ".$_POST['gallery_form_name']."</td></tr>";
$mail_body .= "<tr><td>E-mail: ".$_POST['gallery_form_email']."</td></tr>";
$mail_body .= "<tr><td>Photo : ".$_POST['gallery_form_photo']."</td></tr></table>";   

$mail_to = "banerjeeshubhajit@gmail.com";

if (@mail (nl2br($mail_to), $subject, $mail_body, $headers)) { 
?>

<script type="text/javascript">
alert("Thank You! Your Photo Has Been Submited Successfully");
top.location.replace('http://neelamabasan.in/gallery');
</script>

<?php 
     } else { 
  print ("<h1><font color=\"#880000\">Sorry! An Error Occurred While Sending Message. Please Try Again</font></h1>"); 
} 

} ?&GT;`

1 个答案:

答案 0 :(得分:0)

您正在发送纯文本。

$headers .= "Content-Type: multipart/mixed;\r\n";

尝试将内容类型更改为多部分

等媒体类型