Iam using the following php code in my order form
I need to send user a copy of his/her placed order other than the owner mail. I don't know how to write code in $recepient for sending a copy to user also. I need to use "$Email" for the user email id. Please give me suggestion for writing code.
My php code for order form is as follows:
<?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>";
?>
You could call mail()
again with the user's email address, so:
mail($Email, $subject, $formcontent, $mailheader);
although you may want to change the message text too.
$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>";
}
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.