PHP를 사용하여 이메일을 보내려면 phpMailer를 사용하고 있습니다. 메일이 전송되었지만받은 편지함/스팸 등에서 수신되지 않았습니다. 며칠 전까지는 효과가 있었음이 놀랍습니다. 나는 그것을 테스트했으며 거의 500-600 개의 이메일을 보내고 받았다. 하지만 갑자기 "작동"이 중지되었습니다. 하지만 [하나] 말한다 phpMailer를 사용하여 PHP 메일 스크립트가 작동하지 않습니다.
public static function mailTo($recipients)
{
$f3 = \Base::instance();
$edit = $f3->get('editTrue');
$user = AclHelper::getCurrentUser();
$template= new \Template;
if(isset($edit))
{
$mailBody = $template->render('leave/requestEdit.html');
}
else
{
$mailBody= $template->render('leave/emailTemp.html');
}
// When true, PHPMailer returns exceptions
$mail = new PHPMailer(true);
try {
$mail->isSMTP(); // Set mailer to use SMTP
$mail->isHTML(true);
$mail->addAddress($user['email']);
$mail->addAddress("[email protected]");
// foreach($recipients as $recipient){
// $mail->addCC($recipient);
// }
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->Username = "[email protected]";
$mail->Password = "abcd";
// $mail->Host = $f3->get('GBD.smtp.host'); // Specify main and backup SMTP servers
$mail->setFrom($user['email']);
$userFullName = trim(ucfirst($user['firstname'])) . " " . trim(ucfirst($user['lastname']));
$mail->FromName = $userFullName;
$mail->Body = $f3->get('message');
$mail->Body .="<br>". $mailBody;
if(isset($edit))
{
$mail->AltBody = '';
}
else
{
$mail->AltBody = 'Hello Team,<br>I would like to request leave for the leave dates specified as follows.
Application Date:' . $f3->get('issuedDate') . '<br>Leave requested from:' . $f3->get('leaveFrom') . '<br>Leave requested to:' . $f3->get('leaveTo') . '<br>Leave Description:' . $f3->get('leaveDescription') . 'Leave Type:' . $f3->get('leaveType').'<br><br>Hoping for a positive response.<br><br> Thank you.';
}
$mail->Subject = 'Updates on leave date applied';
$mailStatus = (boolean)$mail->send();
if ($mailStatus === true) {
return $mail;
}
} catch (phpmailerException $e) {
$response = array(
'status'=>'error',
'message'=>'Got some error while sending emails',
'exceptions'=>$e->getMessage()
);
return $response;
} catch (Exception $e) {
$response = array(
'status'=>'error',
'message'=>'Got some error while sending emails',
'exceptions'=>$e->getMessage()
);
return $response;
}
}
내가 정크 이메일을받은 :
여기 내 PHP 스크립트의
This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing
내가 잘못 무슨 일이 일어나고 있는지 알아낼 수 없습니다.
이전까지 작동합니다. 그리고받은 편지함에는 수 많은 이메일이 있습니다.
전자 메일을 보내는 데 제한이 있습니까? 아니면 어떤 사람이 스팸 또는 스푸핑으로 신고했을 수 있습니까?
모든 도움을 주시면 대단히 감사하겠습니다. 감사.
$ mail-> SMTPDebug = 2 설정; 디버그하여 클라이언트 서버 응답을 확인하십시오. –
출력을 어디에서 찾을 수 있습니까? – Azima
그냥 "mailTo"함수의 출력을 echo하려고 시도합니다. –