5

I'm using swiftMailer to send email using SMTP directly.

I get this strange error:

2011/09/23 17:59:01 [error] 489#0: *1032 FastCGI sent in stderr: "PHP Warning:  stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:func(119):reason(252) in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 271
PHP Warning:  stream_socket_client(): Failed to enable crypto in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 271
PHP Warning:  stream_socket_client(): unable to connect to ssl://mail.xxxxx.net:587 (Unknown error) in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 271
PHP Fatal error:  Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host mail.xxxxxxxx.net [ #0]' in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php:273
Stack trace:
#0 /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php(66): Swift_Transport_StreamBuffer->_establishSocketConnection()
#1 /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(116): Swift_Transport_StreamBuffer->initialize(Array)
#2 /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start()
#3 /home/nginx/websites/example.com/www/email.php(23): Swift_Mailer->send(Object(Swift_Message))
#4 {main}
  thrown in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 273" while reading response header from upstream, client: xx.xx.xx.xxx, server: example.com, request: "GET /email.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com"

What does it mean? Thanks

Dail
  • 4,622
  • 16
  • 74
  • 109

3 Answers3

2

The "failure to enable crypto" means that it was unable to secure the connection - check to be sure that you are successfully passing a certificate, and that your passphrase is set correctly.

woody121
  • 358
  • 3
  • 14
0

In my case, the issue was with my mac (OSX Sierra). I uploaded php and cert to my server, ran it, and the notification was delivered.

Duplicate: APNS + PHP "stream_socket_client(): Failed to enable crypto"

stackOverFlew
  • 1,479
  • 2
  • 31
  • 58
0

This error is quite typically that you have tried to contact an invalid port in my experience.

Try telnet mail.xxxxx.net 587, and if you do not get anything about an escape character then it is not the right port.

If you have access, examine the server config to see if you are trying to access a port which is not exposed for ssl streams. Try the telnet command again to probe other possible candidate ports

Scott Anderson
  • 631
  • 5
  • 26