![](/img/trans.png)
[英]Magento - Can I send packing slip as email when order is placed and send together with order mail
[英]I need to send user a copy of the placed order in the form
我在我的订单中使用以下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);
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>";
}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.