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
PHP表单-回复电子邮件问题_Php_Email_Forms_Contact_Reply - Fatal编程技术网

PHP表单-回复电子邮件问题

PHP表单-回复电子邮件问题,php,email,forms,contact,reply,Php,Email,Forms,Contact,Reply,联系方式很好,但我不知道如何设置“回复邮件”。PHP代码如下所示: <?php // Get Data $name = strip_tags($_POST['name']); $email = strip_tags($_POST['email']); $message = strip_tags($_POST['message']); // Send Message mail( "Message from $name", "Name: $name\nEmail: $email\nMess

联系方式很好,但我不知道如何设置“回复邮件”。PHP代码如下所示:

<?php
// Get Data 
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$message = strip_tags($_POST['message']);

// Send Message
mail( "Message from $name",
"Name: $name\nEmail: $email\nMessage: $message\n",
"From: $name <forms@example.net>" );
?>


我想做的是替换“forms@example.com“使用$email,但由于某种原因,它崩溃了,并且从不发送任何东西。

它只是回复给:reply@example.com邮件标题块中缺少的标题?另外,您似乎缺少
mail()
函数的第一个参数,该参数应该是它发送到的地址

Reply to
标题添加到
mail()
的第三个参数中

//发送消息
邮件($to_地址,“来自$name的邮件”,
//信息
“名称:$Name\nEmail:$email\n消息:$message\n”,
//附加标题
“发件人:$name\r\n收件人:reply@example.com"
);

编辑我在问题中漏掉了一个逗号,我认为整个区块都是信息,包括姓名和发件人。以上编辑。我看到您已经有了一个标题块。

这只是回复:reply@example.com邮件标题块中缺少的标题?另外,您似乎缺少
mail()
函数的第一个参数,该参数应该是它发送到的地址

Reply to
标题添加到
mail()
的第三个参数中

//发送消息
邮件($to_地址,“来自$name的邮件”,
//信息
“名称:$Name\nEmail:$email\n消息:$message\n”,
//附加标题
“发件人:$name\r\n收件人:reply@example.com"
);

编辑我在问题中漏掉了一个逗号,我认为整个区块都是信息,包括姓名和发件人。以上编辑。我看到您已经有了一个标题块。

您没有为邮件功能使用正确的参数。看一看

在您的情况下,它将是:

mail( $to,
$subject,
$message,
"From: $name <forms@example.net>" );
mail($to),
$subject,
$message,
“发件人:$name”);

假设您给它一个$to(表示将电子邮件发送给谁)和一个$subject(电子邮件的主题)。

您没有为邮件功能使用正确的参数。看一看

在您的情况下,它将是:

mail( $to,
$subject,
$message,
"From: $name <forms@example.net>" );
mail($to),
$subject,
$message,
“发件人:$name”);
假设您给了它一个$to(表示将电子邮件发送给谁)和一个$subject(电子邮件的主题)。

请看以下片段:

 <?php
    //define the receiver of the email
    $to = 'youraddress@example.com';
    //define the subject of the email
    $subject = 'Test email';
    //define the message to be sent. Each line should be separated with \n
    $message = "Hello World!\n\nThis is my first mail.";
    //define the headers we want passed. Note that they are separated with \r\n
    $headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
    //send the email
    $mail_sent = @mail( $to, $subject, $message, $headers );
    //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
    echo $mail_sent ? "Mail sent" : "Mail failed";
    ?>

在您的代码中,您错过了第一个参数,witch应该是who。

请看以下片段:

 <?php
    //define the receiver of the email
    $to = 'youraddress@example.com';
    //define the subject of the email
    $subject = 'Test email';
    //define the message to be sent. Each line should be separated with \n
    $message = "Hello World!\n\nThis is my first mail.";
    //define the headers we want passed. Note that they are separated with \r\n
    $headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
    //send the email
    $mail_sent = @mail( $to, $subject, $message, $headers );
    //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
    echo $mail_sent ? "Mail sent" : "Mail failed";
    ?>


在您的代码中,您错过了第一个参数,witch应该是who。

当它“崩溃”时,是否产生错误?可能是因为您没有正确地为
mail()指定参数而失败。
请参阅文档:当它“崩溃”时,是否产生错误?可能是因为您没有正确地为
mail()指定参数而失败
请参阅文档:您应该用
\r\n
分隔标题。我做了更改并替换了reply@example.com通过$email发送,但仍显示在回复字段中。请在收到邮件后发布完整的电子邮件标题。更好的是,发布完整的邮件标题和正文。哦,糟糕的是,我没有看到编辑。我会再试一次,让你知道。我半小时或几小时后回来。上一个测试有效,但页面混乱。您应该用
\r\n
分隔标题。我做了更改并替换了reply@example.com通过$email发送,但仍显示在回复字段中。请在收到邮件后发布完整的电子邮件标题。更好的是,发布完整的邮件标题和正文。哦,糟糕的是,我没有看到编辑。我会再试一次,让你知道。我半小时或几小时后回来。最后一个测试成功了,但却弄乱了页面。