简体   繁体   English

Laravel 5.8.* 来自本地服务器的身份验证邮件错误:swift_transportexception (554)

[英]Laravel 5.8.* Auth mail error from local server: swift_transportexception (554)

if I run my project in Laravel 5.8.* from my local PC via MAMP Pro using the normal php artisan make:auth command and the correct SMTP configuration, I cannot send a confirmation mail from my local PC with Mamp via my external mail server.如果我使用普通的php artisan make:auth命令和正确的 SMTP 配置通过 MAMP Pro 从我的本地 PC 在Laravel 5.8.* 中运行我的项目,我无法通过我的外部邮件服务器使用 Mamp 从我的本地 PC 发送确认邮件。

This error code always appears then:此错误代码总是出现在:

Swift_TransportException Swift_TransportException

Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients预期响应代码 354,但得到代码“554”,消息为“554 5.5.1 错误:没有有效的收件人

Laravel storage/day.log: Laravel 存储/day.log:

[2019-03-11 14:25:20] local.ERROR: Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients " {"userId":9,"exception":"[object] (Swift_TransportException(code: 554): Expected response code 354 but got code \\"554\\", with message \\"554 5.5.1 Error: no valid recipients \\" at /Users/*****/Developer/Laravel-Project/Laravel-System/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457) [stacktrace] [2019-03-11 14:25:20] local.ERROR:预期的响应代码为 354,但得到代码“554”,消息为“554 5.5.1 错误:没有有效的收件人”{“userId”:9,“异常” :"[object] (Swift_TransportException(code: 554): 预期的响应代码 354 但得到代码 \\"554\\",消息 \\"554 5.5.1 错误:没有有效的收件人 \\" 在 /Users/***** /Developer/Laravel-Project/Laravel-System/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457) [stacktrace]

However, this appears ONLY on my laptop with MAMP on my web server everything works fine.但是,这只出现在我的笔记本电脑上,我的网络服务器上有 MAMP,一切正常。

In my .env file it looks like this:在我的 .env 文件中,它看起来像这样:

MAIL_DRIVER=smtp
MAIL_HOST=mail.my-external-mail-server.com
MAIL_PORT=587
MAIL_USERNAME=alias@my-domain.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls

and in my cofig/mail.php:在我的 cofig/mail.php 中:

'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'mail.my-external-mail-server.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'alias@my-domain.com', 'name' => 'my-domain.com'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('alias@my-domain.com'),
'password' => env('********'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => ['theme' => 'default',
'paths' => [resource_path('/views/vendor/mail'),],],

These settings also work great with the normal make:auth command from Laravel on my own server with my own mail server but the above error message comes up whenever I test it on my local PC with MAMP.这些设置也适用于来自 Laravel 的普通make:auth命令和我自己的邮件服务器,但每当我在本地 PC 上使用 MAMP 测试时,都会出现上述错误消息。

Does anyone know what it is?有谁知道它是什么? Is it only possible to send mails with an active SSL connection?是否只能使用活动的 SSL 连接发送邮件? How can I avoid this error?我怎样才能避免这个错误?

I just found the answer myself!!!我自己才找到答案!!!

NOTICE: Check before if the mail in connection with the configuration is sent via the SMTP server from another location.注意:请先检查与配置相关的邮件是否从其他位置通过 SMTP 服务器发送。 For example another server or another local development environment.例如另一个服务器或另一个本地开发环境。

Anyone who has the same error should check these entries.任何有相同错误的人都应该检查这些条目。

Change the PORT and the ENCRYPTION to:PORTENCRYPTION更改为:

MAIL_PORT=465
#AND
MAIL_ENCRYPTION=ssl

Then execute the following commands in the Project root folder:然后在项目根文件夹中执行以下命令:

php artisan config:cache
php artisan config:clear
php artisan cache:clear

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM