2015-04-10 10 views
0

Ниже мой кодPHPMailer SMTP Ошибка SSL

<?php 
date_default_timezone_set('Etc/UTC'); 

require 'PHPMailerAutoload.php'; 
$mail = new PHPMailer; 

$mail->isSMTP(); 
$mail->SMTPDebug = 2; 
$mail->Debugoutput = 'html'; 

//Set the hostname of the mail server 
$mail->Host = 'smtp.gmail.com'; 

//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission 
$mail->Port = 587; 

//Set the encryption system to use - ssl (deprecated) or tls 
$mail->SMTPSecure = 'tls'; 

//Whether to use SMTP authentication 
$mail->SMTPAuth = true; 

//Username to use for SMTP authentication - use full email address for gmail 
$mail->Username = "[email protected]"; 

//Password to use for SMTP authentication 
$mail->Password = "password"; 

//Set who the message is to be sent from 
$mail->setFrom('[email protected]', 'First Last'); 

//Set an alternative reply-to address 
$mail->addReplyTo('[email protected]', 'First Last'); 

//Set who the message is to be sent to 
$mail->addAddress('[email protected]', 'John Doe'); 

//Set the subject line 
$mail->Subject = 'PHPMailer GMail SMTP test'; 

//Read an HTML message body from an external file, convert referenced images to embedded, 
//convert HTML into a basic plain-text alternative body 
$mail->msgHTML('test'); 

//Replace the plain text body with one created manually 
$mail->AltBody = 'This is a plain-text message body'; 

//Attach an image file 
$mail->addAttachment('phpmailer.png'); 

//send the message, check for errors 
if (!$mail->send()) { 
    echo "Mailer Error: " . $mail->ErrorInfo; 
} else { 
    echo "Message sent!"; 
} 
?> 

но он отображает сообщение об ошибке:

SERVER -> CLIENT: 220 mx.google.com ESMTP oo3sm681775pdb.26 - gsmtp 
CLIENT -> SERVER: EHLO localhost 
SERVER -> CLIENT: 250-mx.google.com at your service, [124.13.146.153]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250 SMTPUTF8 
CLIENT -> SERVER: STARTTLS 
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 
(!) Warning: stream_socket_enable_crypto(): this stream does not support 
SSL/crypto in C:\wamp\www\phpmailer\class.smtp.php on line 344 

Call Stack 
# Time Memory Function Location 
1 0.0007 253800 {main}() ..\ibdex1.php:0 
2 0.0061 944248 PHPMailer->send() ..\ibdex1.php:52 
3 0.0069 962000 PHPMailer->postSend() ..\class.phpmailer.php:970 
4 0.0069 962368 PHPMailer->smtpSend() ..\class.phpmailer.php:1062 
5 0.0069 963320 PHPMailer->smtpConnect() ..\class.phpmailer.php:1218 
6 0.8391 1164280 SMTP->startTLS() ..\class.phpmailer.php:1343 
7 1.0490 1164576 stream_socket_enable_crypto () ..\class.smtp.php:344 

CLIENT -> SERVER: QUIT 
SERVER -> CLIENT: 
SMTP ERROR: QUIT command failed: 
SMTP connect() failed. 
Mailer Error: SMTP connect() failed. 

ответ

-1

Разрешить доступ к этой учетной записи Unlock account Google отключает его по умолчанию.

Смежные вопросы