如何在我的Laravel项目中通过SMTP发送电子邮件。

huangapple go评论78阅读模式
英文:

How to send email vis SMTP in my Laravel project

问题

我是 Laravel 的初学者。我现在正在使用 Laravel 开发一个网站,但遇到了一个困难的问题。我尝试解决这个问题,但无法解决。我已经实现了登录和注册逻辑,现在我需要重置密码,所以我将发送电子邮件链接给用户以重置密码。

我已经像这张图片一样设置了.env文件:

如何在我的Laravel项目中通过SMTP发送电子邮件。

而且我收到了这个错误消息:

如何在我的Laravel项目中通过SMTP发送电子邮件。

我该如何解决这个问题?(我已经将此网站托管在 cPanel 上。)

我已经多次尝试解决这个问题。

  1. 我看到了一篇文章来解决这个问题。有人告诉我需要将mail.xxx.com -> smtp.xxx.com更改,所以我这样做了,但没有起作用。
  2. 还有人告诉我这是DNS问题,所以我在php.ini文件中添加了'extension=php_openssl.dll',但它也没有起作用。
英文:

I am a beginner with Laravel. I am developing a Website with Laravel now and I face a difficult problem. I tried to solve this issue but I can't do. I already made login and registration logic and I need to reset the password so I am going to send email link to user to reset password.

I already set .env file like this image:

如何在我的Laravel项目中通过SMTP发送电子邮件。

And I got this error message:

如何在我的Laravel项目中通过SMTP发送电子邮件。

How can I solve this issue? (I've already hosted this website on cPanel.)

I tried several times to solve this issue.

  1. I saw a article to solve this issue. Someone told me I need to change mail.xxx.com -> smtp.xxx.com so I did but it doesn't work.
  2. And somebody told me this is DNS issue so I added 'extension=php_openssl.dll' in my php.ini file, but it doesn't work.

答案1

得分: 0

首先,尝试使用 mailtrap,如果你在使用GoDaddy主机,必须考虑以下事项。

我也曾面临相同的问题,当我在GoDaddy的cPanel上无法使用SMTP时,经过与支持团队的长时间交谈,他们告诉我由于他们那边的一些问题,它不适用于PHP 8.0及以上的版本,并建议我使用PHP版本7.4或更低的版本。

英文:

First, try using mailtrap and if you are using GoDaddy hosting you must consider the following.

I also faced the same problem when I could not use SMTP on GoDaddy's cPanel after a long conversation with the support team they told me it would not work on PHP 8.0^ because of some issue at their end and told me to use the PHP version 7.4 or less.

huangapple
  • 本文由 发表于 2023年2月26日 20:35:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75572008.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定