【问题标题】:Error while sending IMAGE with PHP mail code使用 PHP 邮件代码发送 IMAGE 时出错
【发布时间】:2014-02-12 07:55:09
【问题描述】:

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

请帮忙...

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>"); 
} 

} ?>`

【问题讨论】:

标签: php image email inline


【解决方案1】:

您正在提供纯文本。

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

尝试将您的内容类型更改为多部分等媒体类型

【讨论】:

    猜你喜欢
    • 2015-09-03
    • 1970-01-01
    • 1970-01-01
    • 2013-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-21
    相关资源
    最近更新 更多