【发布时间】:2019-08-05 14:57:11
【问题描述】:
我是 Laravel 的新手,我正在尝试配置邮件。我的 .env 文件配置为:
MAIL_DRIVER=SMTP
MAIL_HOST=vserv.******.***
MAIL_PORT=587
MAIL_USERNAME=admin@******.***
MAIL_PASSWORD=********* <--- (9 chars lengh)
MAIL_ENCRYPTION=TLS
对于我的邮件测试,我正在使用 tinker:
>php artisan tinker
>>> Mail::send('mails.contact',[], function($message) { $message->to('sergio@******.****')->subject('Testing email'); });
在测试之前,我将缓存刷新为:
>php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!
Tinker 返回此错误:
Swift_TransportException with message 'Failed to authenticate on SMTP server with username "admin@******.***" using 3 possible authenticators. Authenticator CRAM-MD5 returned Swift_TransportException: Expected response code 235 but got code "535", with message "535 5.7.8 Error: authentication failed: authentication failure
" in ****/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457
服务器端,邮件日志有错误:
Mar 14 16:47:13 vserv plesk_saslauthd[21227]: failed mail authenticatication attempt for user 'admin@******.***' (password len=8)
注意: 我在 env 中使用的密码是 9 个字符,但在错误消息中总是少 1 个字符!如果我输入了错误的 10 字符长度的密码,则会显示错误(密码 len=9),依此类推。有意义吗?
感谢您的任何建议。
【问题讨论】:
-
此错误看起来您的凭据有误。您的密码是否包含
#字符? dotenv 库最近更新了,之后它可能会考虑将任何内容作为评论(所以用引号括住密码) -
是的! psw 包含“#”!!!!!!!哈哈!!!!我要测试一个新的psw!
-
谢谢!!!有用!!!我欠你一杯啤酒!!!我快疯了!谢谢!!!!
标签: laravel authentication smtp