0
SMTP connect() failed PHPmailer - PHP과 같은 문제가 발생합니다.PHP로 이메일을 보내는 방법
public function sendEmail($toAddress, $subject, $message)
{
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'username';
$mail->Password = 'password';
$mail->SMTPSecure = 'tls';
$mail->SMTPDebug = 2;
$mail->Port = 587;
$mail->setFrom('[email protected]', 'Tripmatcher Support');
$mail->addAddress($toAddress);
$mail->Subject = $subject;
$mail->Body = $message;
if (!$mail->send()) {
error_log('Mailer Error: ' . $mail->ErrorInfo);
} else {
error_log('Email has been sent.');
}
}
두 질문 : 다음과 같이 내 코드는
- 내 코드가 올바른 보이는 볼 수 있고, 나 또한 내 이메일 주소에 대한 보안 수준이 낮은 앱을 사용할 수대로까지, 여기 뭐가 문제 ?
- [Mon Sep 18 21 : 01 : 43.342766 2017] [: error] [pid 22052] [클라이언트 2.28.76.119 : 55132] 메일러 오류 : SMTP connect()가 실패했습니다. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting, 리퍼러 :
로그에 표시되는 내용은 모두 어떻게 설명적인 오류 메시지가 있습니까? 비슷한 질문을 시도해 보았습니다. 문제가 정확히 무엇인지 알아 내지 못합니다.
질문에 언급 한 페이지를 읽었습니까? 특히 https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#smtp-error-could-not-connect-to-smtp-host 및 https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#enabling -debug-output 부분 – Nima
dig + short smtp.gmail.com gmail-smtp-msa.l.google.com. 64.233.184.108 64.233.184.109 –
dig + short smtp.gmail.com에서 얻은 것입니다. 또한 SSL은 GoDaddy와 다르므로 그 둘 중 하나라고 생각하지 않습니다. –