发送多个邮件不会发生
在此先感谢所有人。 我正在用php和mysql设计一个购物车。 我想发送订单确认电子邮件给客户,也发送给管理员注册的电子邮件ID。 我的电子邮件功能是
function send_mail($address,$subject,$message,$path){
global $error;
$mail = new PHPMailer();
//$mail->isSMTP();
//$mail->SMTPDebug = 1; // Enable verbose debug output
//$mail->SMTPAuth = true;
//$mail->SMTPSecure ='ssl' ;
//$mail->Host ="smtp.mail.yahoo.com";
//$mail->Port = '465'; // use 587 also
//$mail->Username = "";
//$mail->Password = "";
$mail->setFrom("sales@dressncrafts.com", "Dress N Crafts");
$mail->addReplyTo("sales@dressncrafts.com", "Dress N Crafts");
$mail->addAddress($address); // Add a recipient
$mail->Subject = $subject;
//$mail->AltBody = $message; // optional, comment out and test
$mail->MsgHTML($message);
$mail->addAttachment($path); // attachment
$send = $mail->send();
$mail->clearAddresses();
$mail->clearAttachments();
if(!$send) {
return FALSE;
} else {
return TRUE;
}
}
现在问题是当我触发函数发送邮件时,只发送客户电子邮件但管理邮件不发送。 我试图输入睡眠功能,以不同的名称使用相同的功能,但都是徒劳的。 荒谬的是,如果我改变了邮件的顺序,只有客户邮件正在发送。 请帮我解决问题。 谢谢。 非常密码
$message = "Hello $name, your order (order number:$ordernumber) has been
placed on the date $date with the following details."
.'<br><br><center>'.$body.'</center><br>'."Subtotal:Rs.
$subtotal".'<br>'."Delivery Charges:Extra".'<br>'."Total:Rs.
$total".'<br>'.
"Your order is under process and the invoice is attached with the
mail.Please find it.".'<br><br>'.
"Thanking you".'<br>'.$about->getShopname();
$subject = "Successful order";
$cust_mail=send_mail($email,$subject,$message,$invpath);
$shopsubject = "New Order";
$shop_email= $about->getEmail();
$shop_mail= send_mail($shop_email,$shopsubject,"New order has arrived, find
the attachment",$invpath);
if($shop_mail==TRUE && $cust_mail==TRUE){
foreach($cartresult as $cres)
{
$cart->setIdcart($cres->idcart);
$cart->deleteCart();
}
redirect("../checkout.php?plsord=TRUE&cust={$cust_mail}&shop=
{$shop_mail}");
}
else {
foreach($cartresult as $cres)
{
$cart->setIdcart($cres->idcart);
$cart->deleteCart();
}
redirect("../checkout.php?plsord=TRUE&some=false&cust=
{$cust_mail}&shop={$shop_mail}");
}
链接地址: http://www.djcxy.com/p/69341.html
上一篇: Send multiple mail is not happening
下一篇: Outlook Rest Api sending Mail Request returned status 400