0
When trying to send email in the Portuguese language I get this error message:
[Swift_transportexception]
Expected Response code 250 but got code "530", with message "530 5.7.1 Authentication required"
.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD= xxxxx
MAIL_ENCRYPTION=tls
code Emailcron.php
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class EmailCron extends Mailable
{
use Queueable, SerializesModels;
private $dados;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($dados)
{
$this->dados = $dados;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('corpoEmail')
->to('[email protected]')
->with(['dados' => $this->dados]);
}
}
config/mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => '[email protected]',
'name' => 'DEV',
],
'encryption' => env('ssl', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
];?>
How is your file
config/mail.php
?– Wallace Maxters
I just edited the question with mail.php
– alexjosesilva
Whenever I have that problem, I try to change
MAIL_ENCRYPTION
forssl
or leave it empty. Try this.– Wallace Maxters
The error persists!
– alexjosesilva
Dude, in the spirit of it, I think it would be cool for you to use an http://mailtrap.io of life to test emails, since you’re in a development environment...
– Wallace Maxters
You have to release in Gmail that the email does not have so many restrictions, here on the site already has answer for this if I’m not mistaken.
– novic
How do I do that? I edited the question with the values related to the mail
– alexjosesilva
example: https://www.youtube.com/watch?v=-uOYk1AJpJ0
– novic
ideal explanation: https://learninglaravel.net/learn-to-send-emails-using-gmail-and-sendgrid-in-laravel-5
– novic