Expected response code 250 but got code “501“, with messa php laravel 发邮件 smtp qq邮箱 阿里云

 

 

 

MAIL_MAILER=log

MAIL_DRIVER=smtp

MAIL_HOST=smtpdm.aliyun.com #stmp.qq.com

MAIL_PORT=465

MAIL_USERNAME=hui@xwtool.top #qq邮箱就123456789@qq.com

MAIL_PASSWORD=123456 #qq邮箱里获取的密码

MAIL_ENCRYPTION=ssl

 

 

<?php

return [

    'driver' => env('MAIL_DRIVER', 'smtp'),

 

    'host' => env('MAIL_HOST', 'smtpdm.aliyun.com'),

 

    'port' => env('MAIL_PORT', 465),

    'from' => [

        'address' => env('MAIL_FROM_ADDRESS', env('MAIL_USERNAME')),

        'name' => env('MAIL_FROM_NAME', ''),

    ],

 

    'encryption' => env('MAIL_ENCRYPTION', 'ssl'),

    'username' => env('MAIL_USERNAME'),

    'password' => env('MAIL_PASSWORD'),

    'sendmail' => '/usr/sbin/sendmail -bs',

    'markdown' => [

        'theme' => 'default',

        'paths' => [

            resource_path('views/vendor/mail'),

        ],

    ],

];

 

public function build()
{
    return $this->from('example@example.com')
                ->view('emails.orders.shipped');
}

 

按照laravel 文档搭建好后发现这个错误  不管怎么设置都还是出现问题出在这里

 

public function build()
{
    return $this->view('emails.orders.shipped');
}

去掉这个from就行了

上一篇:Python发送纯文本邮件


下一篇:《计算机网络》笔记——第6章 应用层(二)