2017-07-18 358 views
0

我想從outlook的smtp使用phpmailer類發送電子郵件。我收到以下錯誤。問題發送電子郵件使用outlook的SMTP與phpmailer類

2017-07-18 09:19:33 Connection: opening to ssl://smtp.office365.com:587, timeout=300, options=array ('ssl' =>           array ('verify_peer' => false,           'verify_peer_name' => false,           'allow_self_signed' => true,          ), 
            ) 
2017-07-18 09:19:34 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: 
             error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol [/var/www/html/application/third_party/phpmailer/class.smtp.php line 294] 
2017-07-18 09:19:34 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/var/www/html/application/third_party/phpmailer/class.smtp.php line 294] 
2017-07-18 09:19:34 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.office365.com:587 (Unknown error) [/var/www/html/application/third_party/phpmailer/class.smtp.php line 294] 
2017-07-18 09:19:34 SMTP ERROR: Failed to connect to server: (0) 
2017-07-18 09:19:34 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

有人可以幫助我嗎?

回答

2

在您寫這個問題的時候,您可以點擊錯誤信息中包含的鏈接,該鏈接會向您顯示一個頁面,告訴您如何解決這個確切的錯誤。

您不能使用SMTPSecure = 'ssl'Port = 587;設置SMTPSecure = 'tls'