我对 PHP 很陌生,正在尝试使用 php 在线订购网站。尝试使用“抄送”发送确认电子邮件时遇到问题。
每次处理订单时,订单总是发送到指定为“$from”的“CC”地址,发件人(发件人)是“$to”部分中指定的地址。在收到的电子邮件确认中,它只显示 from 部分,'to' 和 'cc' 为空,如下所示:
From: **$_SESSION['od_email']**
To: *This space is empty*
CC: orders@business.co.uk
谁能帮忙指出我哪里出错了?我附上了下面的代码。
//THIS IS CODE FOR THE EMAIL WHICH IS AUTOMATICALLY SENT TO THE CUSTOMER AND THE BUSINESS WHEN AN ORDER IS SUCCESSFULLY COMPLETED
//define the receiver of the email
$to = $_SESSION['od_email'];
//define the subject of the email
$subject = 'Order Confirmation | Ref No for Order: '. $_SESSION['orderId'];
//define the message to be sent. Each line should be separated with \n
$message = 'test';
//Who the message is from
$from = "orders@business.co.uk";
$cc = "orders@business.co.uk";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From:" . $from;
//bcc header going to the to go to the business as confirmation
$headers = "cc:" . $cc;
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
我需要它显示的是:
From: **orders@business.co.uk**
To: **$_SESSION['od_email'];**
CC: **orders@business.co.uk**
提前感谢您提供的任何帮助