PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 1, 2022

[FIXED] Laravel Send Mail with Yahoo SMTP: Swift_TransportException Expected response code 250

 February 01, 2022     email, laravel-5, php, smtp, yahoo-mail     No comments   

Issue

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:

enter image description here

What should I do?


Solution

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.



Answered By - Carlette
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing