当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Laravel 5 - Swift_TransportException: Expected response code 250 but got code "501", with message "501 5.5.4 Invalid domain name

问题描述:

I was trying to use Laravel Mail service to send an email from my WAMP localhost. And I got the following error:

Swift_TransportException in AbstractSmtpTransport.php line 383:

Expected response code 250 but got code "501", with message "501 5.5.4

Invalid domain name "

The code to send the email is as follows:

public function sendTo($user, $subject, $view, $data = [])

{

\Mail::queue($view, $data, function ($message) use ($user, $subject) {

$message->from(\Config::get('config.admin_email'), \Config::get('config.admin_name'));

$message->to($user->email, $user->full_name)->subject($subject);

});

}

In .env, the setting is:

MAIL_DRIVER=smtp

MAIL_HOST=mail.server.com

MAIL_PORT=587

MAIL_USERNAME=username

MAIL_PASSWORD=password

MAIL_ENCRYPTION=tls

I have tried to change tls to ssl, port number to 465, or 25. None of these worked.

The mail server I am using is Microsoft Exchange server.

分享给朋友:
您可能感兴趣的文章:
随机阅读: