[請益] 如何用php寄大量信件?
一來說在收件者E-mail沒有錯誤的狀況下,我使用phpmailer 1.73寄大量信,是可以的,
但是只要收件者E-mail不存在於對方Server時,或是帳號格式不對,便會等待許久,
可我是採用SMTP的方式,在我的認知裡,用SMTP是跟用outlook轉寄信給朋友一樣,
只要把mail丟給mail server,mail server便會幫你處理轉寄的工作,
而不用等mail server回應,
但我的phpmailer似乎會等待mail server回應,
請問該如何讓我的phpmailer可以做到類似outlook寄信的方式呢???
以下附上我的code:
$mail = new PHPMailer();
$mail->SMTPKeepAlive = true;
$mail->CharSet = "big5";
$mail->Timeout = 60;
$mail->IsSMTP(); // send via SMTP
$mail->Host = "mail.xxx.xxx.xxx"; // SMTP servers
$mail->From = "abc@abc.com";
$mail->FromName = "abc";
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->SetLanguage('en', './phpmailer/language/');
$mail->Subject = $_POST['title'];
$mail->Body = "hello";
for ($i = 0; $i < count($address); $i++) {
$mail->AddBCC($address[$i]);
if ($i % 10 == 0) {
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo . "<br/>";
//exit;
}
$mail->ClearBCCs();
}
}
//寄信給10沒除盡的收件者
$remainder = count($address) - (count($address) % 10);
for ($i = $remainder; $i < count($address); $i++) {
$mail->AddBCC($address[$i]);
}
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo . "<br/>";
}
$mail->SmtpClose();
--
沒圖沒真相,真相在下面啦~~~~~緊來看唷!!!
http://dickstar.blogspot.com/
http://www.youtube.com/watch?v=-aCQWs0Su8M
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.39.126
PHP 近期熱門文章
PTT數位生活區 即時熱門文章