简体   繁体   English

CakePHP SwiftMailer SMTP TLS OpenSSL错误SSL3_GET_RECORD:错误的版本号

[英]CakePHP SwiftMailer SMTP TLS OpenSSL Error SSL3_GET_RECORD:wrong version number

I'm attempting to send an email using the CakePHP SwiftMailer component I found here: http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins 我正在尝试使用我在此处找到的CakePHP SwiftMailer组件发送电子邮件: http//bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments -and-插件

The server I'm sending to is using SMTP with TLS over port 25. Here's the error I get when I attempt to send a mail: 我发送到的服务器使用带有TLS的SMTP通过端口25.这是我尝试发送邮件时出现的错误:

Notice (8): Trying to get property of non-object [APP/views/helpers/hdl_session.php, line 14]

Warning (2): stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number [CORE/vendors/classes/Swift/Transport/StreamBuffer.php, line 271]

Warning (2): stream_socket_client() [function.stream-socket-client]: Failed to enable crypto [CORE/vendors/classes/Swift/Transport/StreamBuffer.php, line 271]

Warning (2): stream_socket_client() [function.stream-socket-client]: unable to connect to tls://mail.aedisit.com:25 (Unknown error) [CORE/vendors/classes/Swift/Transport/StreamBuffer.php, line 271]

Warning (2): Illegal offset type in isset or empty [CORE/cake/libs/i18n.php, line 177]

Warning (2): Cannot modify header information - headers already sent by (output started at /srv/www/stage/hypercool/cake/libs/debugger.php:673) [CORE/cake/libs/controller/controller.php, line 742]

Here's the OpenSSL info from my phpinfo: 这是我的phpinfo的OpenSSL信息:

openssl
OpenSSL support     enabled
OpenSSL Library Version     OpenSSL 0.9.8o 01 Jun 2010
OpenSSL Header Version  OpenSSL 0.9.8o 01 Jun 2010 

And some more info from my phpinfo: 还有一些来自我的phpinfo的信息:

PHP Version 5.3.5-1ubuntu7.2
Registered Stream Socket Transports     tcp, udp, unix, udg, ssl, sslv3, sslv2, tls 

Any help here is greatly appreciated :-) 非常感谢任何帮助:-)

EDIT: 编辑:

SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number SSL操作失败,代码为1. OpenSSL错误消息:错误:1408F10B:SSL例程:SSL3_GET_RECORD:版本号错误

This seems to be the root of the problem. 这似乎是问题的根源。 Anyone know what exactly this means? 任何人都知道究竟是什么意思?

We have resolved this issue. 我们已经解决了这个问题。 The problem appeared to be with our SSL version and the connect method of SwiftMailer. 问题似乎与我们的SSL版本和SwiftMailer的连接方法有关。 The SwiftMailer component was attempting to connect using TLS, when instead it first needed to connect in plaintext, and then initiate the TLS connection. SwiftMailer组件尝试使用TLS进行连接,而首先需要以明文连接,然后启动TLS连接。 Hope this helps anyone else with this problem. 希望这可以帮助其他人解决这个问题。

Update your SwiftMailer libs. 更新您的SwiftMailer库。 I recently ran into this exact problem with SwiftMailer 4.0.6 and upgraded to 4.1.6 - now it works like a charm :) 我最近遇到了SwiftMailer 4.0.6这个确切的问题并升级到4.1.6 - 现在它就像一个魅力:)

I have resolved the issue. 我已经解决了这个问题。 Here is the configuration you can use: 您可以使用以下配置:

'default' => [
    'className' => 'Smtp',
    'host' => 'ssl://smtp.gmail.com',
    'username' => 'GMAIL_EMAIL_ADDRESS',
    'password' => 'GMAIL_PASSWORD',
    'port' => 465, //here was the problem
    'timeout' => 50,
    'client' => null,
    'tls' => null,
    'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],

If you are using EC2 ( AWS Instance ) then you have to allow the 465 port ( create Custom TCP Rule for SMTP - port 25 or SMTPS - port 465 ) 如果您使用的是EC2(AWS实例),那么您必须允许465端口(为SMTP创建自定义TCP规则 - 端口25或SMTPS - 端口465)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误0x1408F10B:带有PayPal SDK的“SSL3_GET_RECORD:错误的版本号” - Error 0x1408F10B: “SSL3_GET_RECORD:wrong version number” with PayPal SDK 卷曲错误:错误:1408F10B:SSL例程:SSL3_GET_RECORD:版本号错误 - Curl Error :error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number 1408F10B:SSL 例程:SSL3_GET_RECORD:错误的版本号 - 1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number PHP致命错误:未捕获的异常:错误:1408F10B:SSL例程:ssl3_get_record:/api.genius.com的版本号错误 - PHP Fatal error: Uncaught Exception: error:1408F10B:SSL routines:ssl3_get_record:wrong version number for /api.genius.com Symfony swiftmailer 通过本地主机 openssl 上的 smtp gmail 错误 - Symfony swiftmailer via smtp gmail on localhost openssl error Swiftmailer连接异常-SMTP连接失败(SSL) - Swiftmailer connection exception - smtp connection failed (ssl) OpenSSL 错误消息:错误:1407742E:SSL 例程:SSL23_GET_SERVER_HELLO:tlsv1 警报协议版本 - OpenSSL Error messages: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version 无法在 Laravel 中发送 SSL/TLS smtp 电子邮件 - Unable to send SSL/TLS smtp emails in Laravel 7 PHP错误的OpenSSL版本 - PHP Wrong OpenSSL Version SSL/TLS 保护需要 openssl 扩展名 - The openssl extension is required for SSL/TLS protection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM