无法通过发送网格smtp发送邮件。

时间:2021-12-21 18:15:18

I am using sendgrid for sending mail in laravel it work perfectly on my local and one aws ec2 instance.But it fail to send mail on another ec2 instance.I tried all the port like 2525,25,2587,587 using tls encryption.But nothing work for me.It give the following error

我正在使用sendgrid在laravel中发送邮件它在我的本地和一个aws ec2实例上完美运行。但是它无法在另一个ec2实例上发送邮件。我尝试了所有端口,如2525,25,2587,587使用tls encryption.But对我没什么用。它给出了以下错误

Failed to authenticate on SMTP server with username "apikey" using 2 possible authenticators

无法使用2个可能的身份验证器在用户名为“apikey”的SMTP服务器上进行身份验证

1 个解决方案

#1


0  

if your issue occurred in server that using https, you should change MAIL_DRIVER to mail and MAIL_PORT to 465

如果您的问题发生在使用https的服务器中,则应将MAIL_DRIVER更改为mail并将MAIL_PORT更改为465

MAIL_DRIVER=mail
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=465
MAIL_USERNAME=yourusername
MAIL_PASSWORD=yourpassword

and on your config/mail.php

并在您的config / mail.php上

'encryption' => env('MAIL_ENCRYPTION', 'tls'),

change to

改成

encryption' => 'ssl',

that's work for me.

这对我有用。

#1


0  

if your issue occurred in server that using https, you should change MAIL_DRIVER to mail and MAIL_PORT to 465

如果您的问题发生在使用https的服务器中,则应将MAIL_DRIVER更改为mail并将MAIL_PORT更改为465

MAIL_DRIVER=mail
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=465
MAIL_USERNAME=yourusername
MAIL_PASSWORD=yourpassword

and on your config/mail.php

并在您的config / mail.php上

'encryption' => env('MAIL_ENCRYPTION', 'tls'),

change to

改成

encryption' => 'ssl',

that's work for me.

这对我有用。