dragon012100
2018-10-11 16:50
浏览 424
已采纳

“预期的响应代码250,但代码为”554“,消息”554 5.2.0 STOR EDRV“

I would like to send an email with an attachment. Using smtp.office365.com

IN Production: ubuntu

smtp.office365.com - Laravel 5.

Expected response code 250 but got code "554", with message "554 5.2.0 STOR EDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message.

IN Localhost :

Expected response code 250 but got code "530", with message "530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [xxxxxx.xxxx.PROD.OUTLOOK.COM]"

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=xxx@org.io
MAIL_PASSWORD='xxxxx'
MAIL_ENCRYPTION=tls

图片转代码服务由CSDN问答提供 功能建议

我想发送附件附件的电子邮件。 使用smtp.office365.com

IN Production:ubuntu

smtp.office365.com - Laravel 5.

预期的响应代码250,但代码为“554”,消息为“554 5.2.0 STOR EDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied;由于消息的永久异常而无法处理消息 无法提交消息。

IN Localhost:

预期的响应代码250,但代码为“530”,并显示消息“ 530 5.7.57 SMTP; 客户端未通过身份验证,以便在MAIL FROM [xxxxxx.xxxx.PROD.OUTLOOK.COM]“

.env
 期间发送匿名邮件 MAIL_DRIVER = smtp 
MAIL_HOST = smtp.office365.com 
MAIL_PORT = 587 
MAIL_USERNAME=xxx@org.io 
MAIL_PASSWORD ='xxxxx'
MAIL_ENCRYPTION = tls 
   
 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongwenghe2416 2019-02-13 01:35
    已采纳

    For Office 365, From_Email must be the same as the logon user. You are changing the From address, and that is not allowed.

    点赞 打赏 评论
  • dounie5475 2018-11-06 16:52

    I was using this to test:

    Mail::send('welcome',[],function($message){ $message->to('xxxxx@xxxxxx.com')->subject('laravel mail'); });
    

    This code made this error

    Swift_TransportException with message 'Expected response code 250 but got code "554"

    I added a from clause that matched my config in .env

    Mail::send('welcome',[],function($message){ $message->from('xxxxx@xxxxxxx.com')->to('xxxxx@xxxxxx.com')->subject('laravel mail'); });
    

    I got the email.

    点赞 打赏 评论
  • dtj4307 2019-04-30 22:17

    Change your setting in mail.php file

    'host' => env('MAIL_HOST', 'your-mail-host'),
      'from' => [
            'address' => env('MAIL_FROM_ADDRESS', 'your-mail@host.com'),
            'name' => env('MAIL_FROM_NAME', 'Your User Name'),
        ],
    
    点赞 打赏 评论

相关推荐