SwiftMailer - PHP - How to disable ssl certificate validation

Angelo Giuffredi picture Angelo Giuffredi · Apr 6, 2016 · Viewed 10.8k times · Source

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

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

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%'

Answer

Maxim  Fazlutdinov picture Maxim Fazlutdinov · Mar 22, 2017

I found an undocumented feature

symfony 2.8, php 5.6, swiftmailer-bundle 2.5.3

Swiftmailer Configuration

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