-1
안녕하세요.이 메시지가 어디서 문제인지 알 수 없습니다. 내 php.ini에서 확장명이 php_openssl.dll 인 줄의 주석 처리를 제거했지만 여전히 작동하지 않습니다. 어떤 조언을 환영합니다.phpmailer SMTP에 연결할 수 없습니다.
메시지를 보낼 수 없습니다. 메일 오류 : SMTP 오류 : SMTP 호스트에 연결할 수 없습니다.
<?php
require 'class.phpmailer.php';
$mail = new PHPMailer;
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server
$mail->Port = 465; // Set the SMTP port
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'mattonirestaurace'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted
$mail->From = '[email protected]';
$mail->FromName = 'Your From name';
$mail->AddAddress('[email protected]', 'Josh Adams'); // Add a recipient
$mail->AddAddress('[email protected]'); // Name is optional
$mail->IsHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <strong>in bold!</strong>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';
?>
코드를 사용하지 않는 예제에 기반을두고 PHPMailer의 이전 버전을 사용하고 있습니다. [최신 정보 얻기] (https://github.com/PHPMailer/PHPMailer)와 함께 제공되는 문서와 예제를 읽으십시오. 앞으로는 게시하기 전에 검색하십시오. – Synchro
가능한 복제본 [PHPMailer : SMTP 오류 : SMTP 호스트에 연결할 수 없습니다] (http://stackoverflow.com/questions/3477766/phpmailer-smtp-error-could-not-connect-to-smtp-host) – Synchro