SwiftMailer - PHP - 如何禁用 ssl 证书验证 [英] SwiftMailer - PHP - How to disable ssl certificate validation

查看:45
本文介绍了SwiftMailer - PHP - 如何禁用 ssl 证书验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了开发目的,我需要禁用 ssl 证书的验证,但我在官方文档中没有找到任何相关信息.http://swiftmailer.org/docs/introduction.html

I need to disable the validation of ssl certificate for developing purpose but i don't find anything about this in official documentation. http://swiftmailer.org/docs/introduction.html

我使用的是 php 5.6 和 Symfony2 (v2.7).

I'm using php 5.6 and Symfony2 (v2.7).

SwiftMailerBundle 的配置参考为:

The configuration reference of SwiftMailerBundle is:

swiftmailer:
   transport:            smtp
   username:             ~
   password:             ~
   host:                 localhost
   port:                 false
   encryption:           ~
   auth_mode:            ~
   spool:
      type:                 file
      path:                 '%kernel.cache_dir%/swiftmailer/spool'
   sender_address:       ~
   antiflood:
      threshold:            99
      sleep:                0
   delivery_address:     ~
   disable_delivery:     ~
   logging:              '%kernel.debug%'

推荐答案

我发现了一个未记录的功能

I found an undocumented feature

symfony 2.8、php 5.6、swiftmailer-bundle 2.5.3

symfony 2.8, php 5.6, swiftmailer-bundle 2.5.3

swiftmailer:
   stream_options:
    ssl:
        verify_peer: false
        verify_peer_name: false

这篇关于SwiftMailer - PHP - 如何禁用 ssl 证书验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆