我想通過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