SSL error when using phpMailer with smtp

SSL error when using phpMailer with smtp

I get the following error message when I'm trying to use phpMailer with Zoho mail:

2016-09-04 09:31:19 Connection: opening to ssl://smtp.zoho.com:587, timeout=300, options=array ( ) 2016-09-04 09:31:20 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client() [ function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol 2016-09-04 09:31:20 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client() [ function.stream-socket-client]: Failed to enable crypto 2016-09-04 09:31:20 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client() [ function.stream-socket-client]: unable to connect to ssl://smtp.zoho.com:587 (Unknown error) 2016-09-04 09:31:20 SMTP ERROR: Failed to connect to server: (0) 2016-09-04 09:31:20 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 




  1. $mail             = new PHPMailer();
  2. $body             = '---Test---';
  3. $mail->SMTPDebug = 3;
  4. $mail->IsSMTP();
  5. $mail->SMTPAuth   = true;
  6. $mail->Host       = "smtp.zoho.com";
  7. $mail->Port       = 587;
  8. $mail->Username   = 'example@zoho.com';
  9. $mail->Password   = 'password';
  10. $mail->SMTPSecure = 'ssl';
  11. $mail->SetFrom('example@zoho.com', 'Web Page');
  12. $mail->Subject    = "Hello";
  13. $mail->AltBody    = '---Test---';
  14. $mail->MsgHTML($body);
  15. $mail->AddAddress('email');

  16. $mail->Send();
Any ideas what's wrong?