trying to send mail using swift mailer, gmail smtp, php
GMail’s SMTP requires encryption. Use: Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, “ssl”);
GMail’s SMTP requires encryption. Use: Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, “ssl”);
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
This problem can generally occur when you do not enable two step verification for the gmail account (which can be done here) you are using to send an email. So first, enable two step verification, you can find plenty of resources for enabling two step verification. After you enable it, then you have to create … Read more
gmail doesn’t allow you to use random From addresses. You have to add and validate the address you’d like to use in the gmail settings: Settings -> Accounts -> Send mail as -> Add another email address you own
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
I was going to say that PHPMailer is no longer developed, and Swift Mailer is. But when I googled … https://github.com/PHPMailer/PHPMailer That suggests its being worked on again. I’ve used PHPMailer a lot, and its always been solid and reliable. I had recently started using Swift Mailer, for the above reason, and it too has … Read more