Home Programming PHP How to disable certificate validation in Symfony Mailer

How to disable certificate validation in Symfony Mailer

How to disable certificate and verify_peer in Symfony Mailer

Symfony
Symfony

To disable certificate validation “verify_peer”, edit file:
symfony/mailer/Transport/Smtp/EsmtpTransportFactory.php

Search line:
if (” !== $dsn->getOption(‘verify_peer’) && !filter_var($dsn->getOption(‘verify_peer’, true), \FILTER_VALIDATE_BOOLEAN)) {

and replace with this line or set true to false:
if (” !== $dsn->getOption(‘verify_peer’) && !filter_var($dsn->getOption(‘verify_peer’, false), \FILTER_VALIDATE_BOOLEAN)) {

also if this line below are true, change to false:
$streamOptions[‘ssl’][‘verify_peer’] = false;
$streamOptions[‘ssl’][‘verify_peer_name’] = false;