How to disable “verify_peer” with Symfony Mailer component?

◇◆丶佛笑我妖孽 提交于 2020-03-14 11:38:58

问题


I'm configuring a mail server (postfix), with a self signed certificate, and it seems this self signed certificate is a problem for the Symfony Mailer component.

On Swiftmailer, using some configuration such as:

transport:
    stream_options:
        ssl:
            allow_self_signed: true

or

stream_options:
    ssl:
        verify_peer: false
        verify_peer_name: false

might fix it, but I can't find a way to do that on mailer (I want to use the YAML configuration files if possible).


回答1:


This option will been enabled when this pull request, which has been already merged into master, is tagged and released.

So it seems you would have to wait for the next Symfony release (this was merged into the 5.1 branch, so it doesn't look like it's going to be available in the 4.x branch at all), and then you will able to do this by adding verify_peer to your Mailer DSN configuration.

Regularly, you'll be able configure Mailer, you need only to create a MAILER_DSN environment variable (usually setting the value on one of your .env files is enough).

In a near future, you'll be able to do this:

MAILER_DSN=smtp://user:pass@localhost?verify_peer=false

But right now (as of 4.4.4 and 5.0.4) you can't do this natively with Symfony Mailer.



来源:https://stackoverflow.com/questions/60329775/how-to-disable-verify-peer-with-symfony-mailer-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!