Swift_TransportException Connection could not be established with host smtp.gmail.com

Fatal error: Uncaught exception ‘Swift_TransportException’ with message ‘Connection could not be established with host smtp.gmail.com [Connection refused #111] Connection refused is a very explicit and clear error message. It means that the socket connection could not be established because the remote end actively refused to connect. It’s very unlikely that Google is blocking the connection. … Read more

Laravel mail: pass string instead of view

update on 7/20/2022: For more current versions of Laravel, the setBody() method in the Mail::send() example below has been replaced with the text() or html() methods. update: In Laravel 5 you can use raw instead: Mail::raw(‘Hi, welcome user!’, function ($message) { $message->to(..) ->subject(..); }); This is how you do it: Mail::send([], [], function ($message) { … Read more

Using php’s swiftmailer with gmail

Don’t mean to resurrect an old post, but just in case others are looking for the answer, and because this post came up during my search for a solution despite the age. When using PHP SwiftMailer to connect to Gmail or Google Apps email accounts you need to use the following $transporter = Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, … Read more