在 GoDaddy 服务器上发送电子邮件时出错:Laravel 5.1

Error while sending email on GoDaddy Server: Laravel 5.1(在 GoDaddy 服务器上发送电子邮件时出错:Laravel 5.1)
本文介绍了在 GoDaddy 服务器上发送电子邮件时出错:Laravel 5.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在 Laravel 5.1 中使用登录系统的内置模板

当我在本地主机上使用忘记密码时,一切正常.以下是我在 .env 文件中的密钥

MAIL_DRIVER=smtpMAIL_HOST=smtp.gmail.comMAIL_PORT=587MAIL_USERNAME=用户名MAIL_PASSWORD=密码MAIL_ENCRYPTION=tls

当我在 Godaddy 服务器上尝试同样的事情时,我面临以下错误.

<块引用>

StreamBuffer.php 第 265 行中的 Swift_TransportException:连接无法与主机 smtp.gmail.com 建立 [连接被拒绝

111]

解决方案

您的 env 文件必须如下所示

MAIL_DRIVER=smtpMAIL_HOST=本地主机MAIL_PORT=465MAIL_USERNAME=邮件密码=MAIL_ENCRYPTION=ssl

在您的 config/mail.php 中,from 值应如下所示...

'from' =>['地址' =>'pankaj@YourDomainName.com', 'name' =>'发件者姓名'],

你的域名来自于什么?或者您可以说,如何在 GoDaddy 中创建电子邮件帐户?

<块引用>

  1. 登录您的 GoDaddy 帐户
  2. 转到您的托管帐户.
  3. 点击管理
  4. 在电子邮件类别下,请点击帐户
  5. 如果没有电子邮件帐户,请创建一个帐户.

就是这样.

假设您有像 Pankaj@yourdomainname.com 这样的电子邮件地址

现在,将此电子邮件地址放在 config/mail.php 的 from 字段中.就是这样.

这将 100% 解决问题

I am using inbuilt template of Login System in Laravel 5.1

When I use Forgot Password on localhost, everything works. Below are my keys in .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=userid
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls

When I try the same thing on Godaddy server, I am facing the below error.

Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host smtp.gmail.com [Connection refused

111]

解决方案

Your env file must be like below

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=465
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=ssl

In your config/mail.php, the from value should be like below...

'from' => ['address' => 'pankaj@YourDomainName.com', 'name' => 'Sender Name'],

What's your domain Name in from ? or you can say, How to create Email account in GoDaddy ?

  1. Login in your GoDaddy Account
  2. Go to your Hosting Account.
  3. Click Manage
  4. Under Email category, Please click Accounts
  5. Create an account if there is no email account.

and that's it.

So let's say you have email address like Pankaj@yourdomainname.com

Now, put this email address in config/mail.php for from field. That's it.

This will 100% fix the issue

这篇关于在 GoDaddy 服务器上发送电子邮件时出错:Laravel 5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

In PHP how can you clear a WSDL cache?(在 PHP 中如何清除 WSDL 缓存?)
failed to open stream: HTTP wrapper does not support writeable connections(无法打开流:HTTP 包装器不支持可写连接)
Stop caching for PHP 5.5.3 in MAMP(在 MAMP 中停止缓存 PHP 5.5.3)
Caching HTTP responses when they are dynamically created by PHP(缓存由 PHP 动态创建的 HTTP 响应)
Memcached vs APC which one should I choose?(Memcached 与 APC 我应该选择哪一个?)
What is causing quot;Unable to allocate memory for poolquot; in PHP?(是什么导致“无法为池分配内存?在 PHP 中?)