I wanna to send mail with Yahoo SMTP service but return error in Laravel 5.5:
Expected response code 250 but got code "550", with message "550 Request failed; Mailbox unavailable "
Before that I tested send mail with Gmail SMTP service, every things is ok, but about Yahoo I have problem. My .env
configuration is:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mail.yahoo.com
MAIL_PORT=587
MAIL_USERNAME=example@yahoo.com
MAIL_PASSWORD=*****
MAIL_ENCRYPTION=tls
I send mail with this code:
public function sendMail(){
$data = []; // Empty array
Mail::send('welcome', $data, function($message)
{
$message->to('john.doe@outlook.com', 'John Doe')->subject('Welcome!');
});
return 'ok';
}
Even I active SMTP from Yahoo mail configuration:
What should I do?
MAIL_FROM_ADDRESS is required and the value is just equal to MAIL_USERNAME.
Your .env should be like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mail.yahoo.com
MAIL_PORT=587
MAIL_FROM_ADDRESS=example@yahoo.com
MAIL_USERNAME=example@yahoo.com
MAIL_PASSWORD=*****
MAIL_ENCRYPTION=tls
This solves the problem.