그래서 나는 다음과 같은 코드가 있습니다G-스위트 룸을 통해 대량 메일 PHPMAILER 보내기
while(list($i, $data_subscriber) = each($subscriber)) {
$email_counter = $i + 1;
echo ($email_counter).') '.$data_subscriber->field_1.' '.$data_subscriber->field_2.' - '.$data_subscriber->email.''."\n";
flush();
$language = $data_subscriber->lang;
$body_mail = include($template_send_newsletter);
$first_name_idx = $data_subscriber->field_1;
$last_name_idx = $data_subscriber->field_2;
if (mail_send(strtolower($data_subscriber->email),
(IsSet($first_name_idx) && IsSet($last_name_idx) ? $first_name_idx.' '.$last_name_idx : $data_subscriber->email),
$site_admin,
$site_name,
'Newsletter ['.date('d/m/Y', time()).']',
true,
$body_mail,
NULL,
false)) {
reset($data_subscriber->newsletter_item);
unset($log_detail);
$log_detail = "";
while(list($j, $list_of_news_to_send) = each($data_subscriber->newsletter_item)) {
$log_detail = (IsSet($list_of_news_to_send->title) ? $list_of_news_to_send->title."\n" : '');
$log_detail = (IsSet($list_of_news_to_send->subtitle) ? $list_of_news_to_send->subtitle."\n" : '');
$log_detail = (IsSet($list_of_news_to_send->creation_date) ? $list_of_news_to_send->creation_date."\n" : '');
$log_detail = "\n";
} /* end while */
write_newsletter_detail($data_subscriber->id_subscription,
$data_subscriber->email,
'Y',
$log_detail);
}
else {
write_newsletter_detail($data_subscriber->id_subscription,
$data_subscriber->email,
'N',
NULL);
} /* end if mail_send */
} /* end while */
그리고 다음과 같은 기능을 내가 Gmail을 사용하여 여러 전자 메일을 보내 PHPMailer를 사용하고
function mail_send($rcpt_to,
$to_name,
$mail_from,
$from_name,
$subject,
$isHTML = true,
$body,
$attachment = NULL,
$direct_delivery = false,
$reply_to = NULL){
$mail = new PHPmailer;
$mail->isSMTP();
$mail->SMTPDebug = 3;
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "password";
$mail->Timeout = 3600;
$mail->addAddress(trim($rcpt_to), trim($to_name));
$mail->setFrom($mail_from,$from_name);
$mail->Subject = $subject;
$mail->Body = $body;
if ($isHTML) {
$mail->IsHTML(true);
$mail->AltBody = strip_tags($mail->Body);
}
if (IsSet($attachment)) {
$mail->AddAttachment($attachment['tmp_name'], $attachment['name']);
}
if (IsSet($reply_to)) {
$mail->AddReplyTo($reply_to);
}
if (!$mail->send()) {
return false;
} else {
return true;
}
}
SMTP 서버. 나는 4 개의 파일을 포함하고 있지만 뉴스 레터를 보내는 코드는 거의 같다. 내 파일 중 하나가 (~ 60 명의받는 사람에게) 모든 전자 메일을 보내고 있습니다 다른 3 개의 파일은 각각 하나의 전자 메일을 ~ 600 명의받는 사람에게 보내야합니다. 여기에서 문제가 발생하면 전자 메일의 절반이 전송되고 다른 전자 메일은 전송되지 않습니다. 스크립트를 실행했지만 이번에는 수신자 수가 적 으면 처음으로 전자 메일을받지 못했습니다. 보내는 중입니다.
나는 내 도메인에서 GMAIL을 사용하고 있습니다. 그래서 나는 어떤 한계도 넘지 않는다.
이 문제가 발생할 수있는 이유는 무엇입니까? 어떤 아이디어? 고맙습니다.
UPDATE ** 내가이 오류를받을 전송되는 일부 이메일 후
SERVER -> CLIENT: 454 4.7.0 Too many login attempts, please try again later. e11sm950198edd.68 - gsmtp
. 어떤 아이디어?
UPDATE ***
나는 그것이 SMTP 서버에 모든 전자 메일을 연결하지 그래서 코드를 변경 관리$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 3;
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->Username = "[email protected]";
$mail->Password = "password";
$mail->setFrom($site_noreply, $site_name);
$subjectnewsletter = 'Newsletter ['.date('d/m/Y', time()).']';
$mail->Subject = $subjectnewsletter;
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
reset($subscriber);
while(list($i, $data_subscriber) = each($subscriber)) {
$email_counter = $i + 1;
echo ($email_counter).') '.$data_subscriber->field_1.' '.$data_subscriber->field_2.' - '.$data_subscriber->email.''."\n";
flush();
$language = $data_subscriber->lang;
$first_name_idx = $data_subscriber->field_1;
$last_name_idx = $data_subscriber->field_2;
$fullname = $first_name_idx.' '.$last_name_idx;
$bodymail = include($template_send_newsletter);
$mail->msgHTML($bodymail);
$mail->addAddress($data_subscriber->email, $fullname);
reset($data_subscriber->newsletter_item);
unset($log_detail);
$log_detail = "";
while(list($j, $list_of_news_to_send) = each($data_subscriber->newsletter_item)) {
$log_detail = (IsSet($list_of_news_to_send->title) ? $list_of_news_to_send->title."\n" : '');
$log_detail = (IsSet($list_of_news_to_send->subtitle) ? $list_of_news_to_send->subtitle."\n" : '');
$log_detail = (IsSet($list_of_news_to_send->creation_date) ? $list_of_news_to_send->creation_date."\n" : '');
$log_detail = "\n";
} /* end while */
if (!$mail->send()) {
write_newsletter_detail($data_subscriber->id_subscription,
$data_subscriber->email,
'N',
NULL);
echo $mail->ErrorInfo;
break; //Abandon sending
} else {
write_newsletter_detail($data_subscriber->id_subscription,
$data_subscriber->email,
'Y',
$log_detail);
echo "Message sent";
}
$mail->clearAddresses();
$mail->clearAttachments();
} /* end while */
.
SMTP server error: MAIL FROM command failed
아마도 스팸을 막는 속도 제한이 있습니까? –
"내 도메인에서 GMAIL을 사용하고 있습니다. 따라서 제한을 초과하지는 않습니다." 여전히 한계가 있습니다. https://support.google.com/a/answer/166852?hl=ko 실제 뉴스 레터 시스템을 사용하십시오. – ceejayoz
잘 오류가 잘못되었다고 분명히 말하면 모든 이메일에 다시 로그인하십시오 – Peter