Mail config for Laravel over RoundCube

梦想的初衷 提交于 2021-02-11 15:13:21

问题


I am using Laravel to send out some emails from RoundCube. The trouble is that I keep getting the same error

Failed to authenticate on SMTP server with username "user@email.com" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 250 but got code "530", with message "530 5.7.1 Client was not authenticated
 ". Authenticator PLAIN returned Expected response code 250 but got code "530", with message "530 5.7.1 Client was not authenticated.

I have looked around and havent found an accurate answer for that. Here is a part of the .env file that is relevant to the problem at hand.

MAIL_DRIVER=smtp
MAIL_HOST=ssl0.ovh.net
MAIL_PORT=465
MAIL_USERNAME=user@email.com
MAIL_PASSWORD=somepassword
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

I tried to replace the MAIL_ENCRYPTION and MAIL_PORT with tls and 587 respectively. Also, I made sure that the credentials actually work. I also looked at the ovh docs which were not helpful at all for sending mails. Also, there is no option to allow less secure accounts like in Gmail.

Thanks


回答1:


First remove all mail configuration from .env file stated with MAIL_

Then open your mail.php from config folder and create a new array under smtp.

'gmail' => [
        'transport' => 'smtp',
        'host' => 'smtp.gmail.com',
        'port' => 465,
        'encryption' => 'ssl',
        'username' => 'aravvi@gmail.com',
        'password' => 'xxigefvqehfypdmg',
    ],

then mention it in your default mailer

'default' => env('MAIL_MAILER', 'gmail'),

run these commnands

php artisan config:clear

and

compser dump-autoload

then

php artisan serve

hope will solve your problem.



来源:https://stackoverflow.com/questions/64777498/mail-config-for-laravel-over-roundcube

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!