How to add SSL option in Laravel SMTP

By default Laravel using swift mailer. So the SSL option can be enabled by reconfiguring the swift mailer settings.

For setting this, open the file 'swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php' inside the website folder.

Then update the SSL options to this file and save it. The newly added lines are shown as bold below.

private function _establishSocketConnection()
$host = $this->_params['host'];
if (!empty($this->_params['protocol'])) {
$host = $this->_params['protocol'].'://'.$host;
$timeout = 15;
if (!empty($this->_params['timeout'])) {
$timeout = $this->_params['timeout'];
$options = array(
    'ssl' => array(
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true


That's all.....

Leave a Reply