PHPMailer_V5.1을 사용하여 Gmail을 통해 이메일을 보내려고합니다.PHPMailer_v5.1을 사용하여 Gmail을 통해 이메일을 보낼 수 없습니다.
, 다음과 같은 오류
SMTP를 얻기 -> 오류 : 서버에 연결하지 못했습니다 : 소켓 전송 "SSL"를 찾을 수 없습니다 - 당신이 PHP를 구성 할 때 당신은 그것을 가능하게하는 것을 잊지 않았다? (41961176) SMTP 오류 : SMTP 호스트에 연결할 수 없습니다.
이 다음은 PHPMailer 다운로드와 함께 제공되는 코드입니다, 난 그냥
<?php
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "********"; // GMAIL password
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->AddAddress('[email protected]', 'John Doe');
$mail->SetFrom('[email protected]', 'First Last');
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML(file_get_contents('contents.html'));
$mail->AddAttachment('images/phpmailer.gif'); // attachment
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
$mail->Send();
echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
당신은 상단에 mail.yourdomain.com에 HOST를 설정하는 것 같다. 그것을 제거하고 도움이되는지보십시오. –
아무런 차이가 없습니다. – San