Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.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 - Fatal编程技术网

Php 我需要向用户发送表单中已下订单的副本

Php 我需要向用户发送表单中已下订单的副本,php,Php,我在订单中使用以下php代码 我需要向用户发送他/她的订单副本,而不是所有者邮件。我不知道如何用$recepient编写代码,以便将副本发送给用户。我需要使用“$Email”作为用户电子邮件id。 请给我写代码的建议 我的订单php代码如下: <?php $Email = @trim(stripslashes($_POST['Email'])); $Name = $_POST['Name']; $Email = $_POST['Email

我在订单中使用以下php代码

我需要向用户发送他/她的订单副本,而不是所有者邮件。我不知道如何用$recepient编写代码,以便将副本发送给用户。我需要使用“$Email”作为用户电子邮件id。 请给我写代码的建议

我的订单php代码如下:

       <?php
      $Email = @trim(stripslashes($_POST['Email']));

      $Name = $_POST['Name'];
      $Email = $_POST['Email'];
      $Business = $_POST['Business'];
      $phone= $_POST['phone'];
      $productid= $_POST['productid'];
      $producttype= $_POST['producttype'];
      $Productquantity= $_POST['Productquantity'];
      $Shippingaddress= $_POST['Shippingaddress'];
      $Message = $_POST['Message'];

     $formcontent= 
    "$Name is sending you a request for the product enquiry.  \n
       Details of  the Product Enquiry person are as follows- \n
     Name: $Name \n
     Contact Number: $phone \n
     Email: $Email \n
     Business Name/Company Name: $Business \n
     Product Id: $productid \n
     Product Type: $producttype \n
     Product Quantity: $Productquantity \n
     Comment: $Message \n
     Shipping Address: $Shippingaddress";

     $recipient = "info@domain.com";
     $subject = "Request for Product Enquiry";
     $mailheader = "From: $Name \r\n";
     mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "<h4><font color='#2A007D'><strong><center>Thank You $Name !
                We have received your Order details and 
              we will contact you as soon as possible. 
             <br>Your Order details has been sent to your Email also.
             </center></strong></font></h4>";
     ?>
您可以使用用户的电子邮件地址再次调用
mail()
,因此:

mail($Email、$subject、$formcontent、$mailheader)

尽管您可能也想更改邮件文本。

$mail=mail($recipient,$subject,$formcontent,$mailheader);
$mail = mail($recipient, $subject, $formcontent, $mailheader);

 if(!$mail)
  {
     echo <h4><font color='red'>Failed</font></h4>;
  }
  else
  {
     echo "<h4><font color='#2A007D'><strong><center>Thank You $Name ! We have received your Order details and we will contact you as soon as possible. <br>Your Order details has been sent to your Email also.</center></strong></font></h4>";
  }
?>
如果(!$mail) { 回波失败; } 其他的 { echo“谢谢$Name!我们已收到您的订单详细信息,我们将尽快与您联系。
您的订单详细信息也已发送到您的电子邮件。
”; } ?>
只需再次发送即可。复制最后一行(
mail($user\u-mail,$subject,$formcontent,$mailheader);
您就完成了……为什么要使用
stripslashes
?您确定启用了神奇引号吗?如果没有,您不应该使用它。我已经放置了行邮件($user\u-mail,$subject,$formcontent,$mailheader);但是用户没有收到任何邮件
$mailheader=“From:”.$Name;
alter this我使用了以下代码,其工作原理是:但在用户电子邮件中,它显示为“未知发件人”。……$subject=“产品查询请求”;$headers=”From:“.$Name”。\r\n“'Cc:”.$email.\r\n”邮件($recipient、$subject、$formcontent、$headers)或die(“Error!”);什么是
$Name
?如果要将其用作发件人:邮件头,则该电子邮件地址必须是有效的电子邮件地址,且格式良好