升级到php 5.6(mac os x sierra)之后,我无法在本地测试环境中发送邮件。Symfony swiftmailer通过本地主机上的smtp gmail openssl错误
但令人伤心的是,通过在Symfony中的swiftmailer发送邮件不起作用。
这是错误:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
我发现了什么至今:
由于PHP 5.6的OpenSSL似乎要求:http://php.net/manual/en/migration56.openssl.php
因为更新后,我是不能够使用的file_get_contents根本没有这个错误,所以我所做的就是指定一个 openssl.cafile = 在我的php ini中,就像我在这里找到的那样:https://andrewyager.com/2016/10/04/php-on-macos-sierra-cant-access-ssl-data/
现在file_get_contents再次工作,但我无法通过smtp发送swiftmailer邮件。
这是我swiftmailer配置:
swiftmailer:
transport: "smtp"
host: "smtp.gmail.com"
username: "%mailer_user%"
password: "%mailer_password%"
auth_mode: login
port: 587
encryption: tls
delivery_address: "%mailer_delivery_address%"
spool: { type: memory }
我必须提供其他任何地方的symfony/swiftmailer我的凭证档案错误?
我已经找到了这个:PHP - Swiftmailer using STARTTLS and self signed certificates 但是对于这样的硬编码解决方案不是一种选择,因为我想部署代码库而不必每次都改变它。我更喜欢在系统级别解决这个问题。
请注明您使用的OpenSSL版本。还请显示设置OpenSSL使用的上下文的代码。它应该类似于OpenSSL wiki上的[SSL/TLS Client](https://wiki.openssl.org/index.php/SSL/TLS_Client)。 – jww