我希望在处理gmail
时使用Laravel 5.4
和Mailtrap
向localhost:8888
地址发送电子邮件。
我收到此错误Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
我试过
php artisan config:clear
有什么问题?
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=xxxxx
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=example@example.com
MAIL_FROM_NAME=Leo
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'username' => env('xxxxx'),
'password' => env('xxxxx'),
答案 0 :(得分:2)
我需要改变
'username' => env('xxxxx'),
'password' => env('xxxxx'),
到
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
答案 1 :(得分:0)
The below code (in .env file) solved my problem in sending verification
email - Laravel 5.7. No need to change in config/mail.php
MAIL_DRIVER=smtp
MAIL_HOST=mail.somedomain.org
MAIL_PORT=465
MAIL_USERNAME=someone@somedomain.org
MAIL_PASSWORD=your_pwd
MAIL_ENCRYPTION=SSL
MAIL_FROM_ADDRESS=someone@somedomain.org
MAIL_FROM_NAME=SenderName