小编Ada*_*att的帖子

预期响应代码 235 但得到代码 535 laravel 使用 office365 smtp 发送电子邮件

我想在 laravel 应用程序中使用我的 office365 smtp 凭据发送电子邮件。我在我的 .env 文件中对电子邮件设置进行了如下更改:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=info@***.com
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)

当我尝试发送电子邮件时,我收到了类似的错误

Failed to authenticate on SMTP server with username \"info@omoyyc.com\" using 2 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code \"535\", with message \"535 Incorrect authentication data\r\n\"
Run Code Online (Sandbox Code Playgroud)

我的电子邮件发送代码如下

Mail::send(array(), array(), function ($m) use ($templatecontent) {
        $m->from('customerservice@****.com', 'TEST');
        $m->to('test@gmail.com', 'Test')
                ->subject($templatecontent['subject'])
                ->setBody($templatecontent['content'], 'text/html');
    });
Run Code Online (Sandbox Code Playgroud)

谁能指导我是什么问题以及如何解决这个问题?

email sendmail office365 laravel

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

email ×1

laravel ×1

office365 ×1

sendmail ×1