I\'m trying to send an email from Gmail using Laravel from localhost. I\'m getting this error: Connection could not be established with host smtp.gmail.com [ #0]
I\'
I had the same error: Connection could not be established with host smtp.gmail.com [ #0] and followed the steps outlined here: https://github.com/swiftmailer/swiftmailer/issues/544.
Try adding the following lines to _establishSocketConnection() in Swift/Transport/StreamBuffer.php on line 263:
$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;
Note that this is not a perfect solution as it involves: a) Hacking core code which may be overwritten in a SwiftMailer update, and b) decreases the security of your app as you're no longer validating the connection. But as a temporary work-around it worked for me.