Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 显示服务器详细信息的确认电子邮件,而不是noreply电子邮件_Php_Email - Fatal编程技术网

Php 显示服务器详细信息的确认电子邮件,而不是noreply电子邮件

Php 显示服务器详细信息的确认电子邮件,而不是noreply电子邮件,php,email,Php,Email,我使用此脚本不仅向注册人的域发送电子邮件,而且向向向注册人发送消息的人发送确认电子邮件。 php块是: <?php if( isset($_POST['n']) && isset($_POST['e']) && isset($_POST['tel']) && isset($_POST['subject']) && isset($_POST['m'])){ $n = $_POST['n']; $e = $_POS

我使用此脚本不仅向注册人的域发送电子邮件,而且向向向注册人发送消息的人发送确认电子邮件。 php块是:

<?php
if( isset($_POST['n']) && isset($_POST['e']) && isset($_POST['tel']) && isset($_POST['subject']) && isset($_POST['m'])){
    $n = $_POST['n'];
    $e = $_POST['e'];
    $s = $_POST['subject'];
    $t = $_POST['tel'];
    $m = nl2br($_POST['m']);
    $to = "info@domain.com";
//    $from = $e;
    $subject = 'Contact Form Message';
    $message = '<b>Name:</b> '.$n.' <br><b>Email: '.$e.'</b><br>Subject: '.$s.'<p>'.$m.'</p>';
    $conf_sender = 'Name of company <no-reply@domain.com>';
    $conf_mess = "Dear ".$n."\nThank you for your enquiry. Your message has been sent and will be sent and will be dealt with shortly.\nPlease wait for a reply";
    $conf_mess .="\nYour Message: ".$m."\n";
    $conf_mess .="MIME-Version: 1.0\n";
    $conf_mess .="Content-type: text/html; charset=iso-8859-1\n";
    $headers = "From: $e\n";
    $headers .="MIME-Version: 1.0\n";
    $headers .="Content-type: text/html; charset=iso-8859-1\n";
    if( mail($to, $s, $message, $headers) ){
        mail($e,$s,$conf_mess,$conf_sender);
        echo "success";
    } else {
        echo "The server failed to send the message. Please try again later.";
    }
}
?>

这也出现在邮件的末尾,不应该显示出来

MIME版本:1.0内容类型:text/html;字符集=iso-8859-1


您发送了2封邮件,其中包含2封不同的邮件,第一封邮件收到了$message,第二封邮件收到了$conf\u mess,因此请查看您的邮件内容,您的邮件显示正常:

因为你把$conf_搞砸了:

$conf_mess.=“内容类型:text/html;charset=iso-8859-1\n”

if( mail($to, $s, $message, $headers) ){
    mail($e,$s,$conf_mess,$conf_sender);
你想要这个:

<?php
if( isset($_POST['n']) && isset($_POST['e']) && isset($_POST['tel']) && isset($_POST['subject']) && isset($_POST['m'])){
    $n = $_POST['n'];
    $e = $_POST['e'];
    $s = $_POST['subject'];
    $t = $_POST['tel'];
    $m = nl2br($_POST['m']);
    $to = "info@domain.com";
//    $from = $e;
    $subject = 'Contact Form Message';
    $message = '<b>Name:</b> '.$n.' <br><b>Email: '.$e.'</b><br>Subject: '.$s.'<p>'.$m.'</p>';

    $conf_sender = 'Name of company <no-reply@domain.com>';
    $conf_sender .="MIME-Version: 1.0\n";
    $conf_sender .="Content-type: text/html; charset=iso-8859-1\n";
    $conf_mess = "Dear ".$n."\nThank you for your enquiry. Your message has been sent and will be sent and will be dealt with shortly.\nPlease wait for a reply";
    $conf_mess .="\nYour Message: ".$m."\n";


    $headers = "From: $e\n";
    $headers .="MIME-Version: 1.0\n";
    $headers .="Content-type: text/html; charset=iso-8859-1\n";
    if( mail($to, $s, $message, $headers) ){
        mail($e,$s,$conf_mess,$conf_sender);
        echo "success";
    } else {
        echo "The server failed to send the message. Please try again later.";
    }
}
?>


你应该考虑使用PHPMALLER或类似的东西。获取标题、编码和每一个正确的编码都是一项非常艰巨的工作。PHPMailer为你做这项工作。但在我给脚本添加内容之前,它一直在工作。你添加了什么?还是。如果不查看实际的邮件内容(带有标题),调试这一点是很困难的。为了您自己的利益,我建议您使用PHPMailer发送电子邮件。我认为这是连接到确认消息的“不应该显示”显示,因为您在
$conf\u mess
末尾明确告诉它。发送到服务器的邮件看起来很好,没问题it@Mr.Bean我只是告诉你为什么在结尾显示MIME版本:1.0内容类型:text/html;charset=iso-8859-1我没有告诉你邮件没有发送,只是告诉你为什么在最后显示你所说的文本read plz。