swiftmailer
Adding line breaks to a text/plain email
use double quotes like this ->setBody(“Did you request a password reset for your account?\r\n\r\nIf yes, click here:\r\nhttp://www.website.com”, ‘text/plain’);
Address in mailbox given [] does not comply with RFC 2822, 3.6.2. when email is in a variable
Your email variable is empty because of the scope, you should set a use clause such as: Mail::send(’emails.activation’, $data, function($message) use ($email, $subject) { $message->to($email)->subject($subject); });
Failed to authenticate on SMTP server error using gmail
This will not work as of May 30, 2022 checkout here https://support.google.com/accounts/answer/6010255?hl=en&authuser=6 Thanks @sarout for pointing this out. Did you turn on the “Allow less secure apps” on? go to this link https://myaccount.google.com/security#connectedapps Take a look at the Sign-in & security -> Apps with account access menu. You must turn the option “Allow less secure … Read more
PhpMailer vs. SwiftMailer? [closed]
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
Expected response code 220 but got code “”, with message “” in Laravel
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
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