我想通过PHP脚本发送电子邮件。我可以发送成功,但没有电子邮件到达收件人的抄送字段..是否有问题的标题?电子邮件抄送不工作
function send_email($to,$subject,$body,$cc = ''){
require_once "Mail.php";
$from = "<removed>";
$host = "smtp.domain.com";
$username = "<removed>";
$password = "<removed>";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'Cc' => $cc);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
$response["success"] = 0;
$response["message"] = $mail->getMessage();
echo json_encode($response);
}else {
$response["success"] = 1;
$response["message"] = "Email sent to " . $to;
echo json_encode($response);
}
}
沉默是因为没有人使用梨邮寄论文的日子。 – 2015-11-04 21:34:05
我现在使用这个 - https://github.com/Synchro/PHPMailer – mboy