# M2使用smtp插件，为什么报authentication failed错误？

**URL:** https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300
**Category:** Magento 2.X
**Created:** [2018 年1 月 31 日 02:20 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300 "2018-01-31T02:20:26Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 02:20 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/1 "2018-01-31T02:20:26Z")

</div>

M2.1.8的项目中使用了mageplaza的smtp插件，配置如下：  
Host：[mail.ubuy-shop.com](http://mail.ubuy-shop.com)  
Port：25  
Authentication：login  
Username：service@ubuy-shop.com  
Protocol：none  
然后发送测试邮件就报下面这个错，不知道怎么回事  
5.7.8 Error: authentication failed: authentication failure

之前用的smtp.1und1.de是可以的，换了个就出问题了  
Host：[smtp.1und1.de](http://smtp.1und1.de)  
Port：465  
Authentication：login  
Username：service@domain.com  
Protocol：ssl  
这个是可以的，[不知道是不是不支持mail.ubuy-shop.com](http://xn--mail-fb5faa6204bqdeczcba9155c6m1d.ubuy-shop.com)

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 02:36 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/2 "2018-01-31T02:36:27Z")

</div>

> [@huichen2017](#):
>
> 5.7.8 Error: authentication failed: authentication failure

身份验证失败，换端口或者加上ssl试试

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 02:39 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/3 "2018-01-31T02:39:46Z")

</div>

> [@Shuai](#):
>
> 身份验证失败，换端口或者加上ssl试试

加ssl就发送不了，报Could not open socket错。

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 02:41 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/4 "2018-01-31T02:41:24Z")

</div>

> [@huichen2017](#):
>
> 加ssl就发送不了

用的是哪个邮箱？

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 02:44 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/5 "2018-01-31T02:44:23Z")

</div>

> [@Shuai](#):
>
> 用的是哪个邮箱？

我也不知道，只给我提供了host：[mail.ubuy-shop.com](http://mail.ubuy-shop.com)、用户名service@ubuy-shop.com和密码。  
加ssl就发送不了，报Could not open socket错。

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 02:45 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/6 "2018-01-31T02:45:51Z")

</div>

那你先尝试本地mail客户端能正常连接之后，再给Magento设置.

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 02:47 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/7 "2018-01-31T02:47:26Z")

</div>

> [@Shuai](#):
>
> 先尝试本地mail客户端能正常连接之后

昨天连接了，可以发送，就是到magento中就发送不了。

 ![](https://forum.magentochina.org/uploads/default/original/1X/1c19dcd234ec4930b50c1a3bc15bd9becf2b586e.png)

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 02:52 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/8 "2018-01-31T02:52:22Z")

</div>

就报错信息来说，就是身份验证错误.不知道具体的邮箱配置的话，还真不好操作.  
只有多做尝试了，比如先把Username：service@ubuy-shop.com在Magento上设置为service之类的。

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 02:55 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/9 "2018-01-31T02:55:04Z")

</div>

> [@Shuai](#):
>
> 比如先把Username：service@ubuy-shop.com在Magento上设置为service之类的

这个是什么意思啊？

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 02:55 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/10 "2018-01-31T02:55:51Z")

</div>

错误提示是身份验证错误  
你试试把用户名改为service试试

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 02:59 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/11 "2018-01-31T02:59:50Z")

</div>

> [@Shuai](#):
>
> 你试试把用户名改为service试试

改成service也是报身份验证错误。

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 03:17 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/12 "2018-01-31T03:17:40Z")

</div>

就目前你给的信息，我实在是无法诊断具体原因了，如果你怀疑是插件的问题，你可以尝试更换插件。  
最好是知道使用的什么邮箱，再看该邮箱的帮助。  
比如你的这个错误，如果使用的是Gmail，那就可能需要该IP登录一次mail的web版，做了身份验证，才能正常使用.

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 03:25 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/13 "2018-01-31T03:25:39Z")

</div>

> [@Shuai](#):
>
> 如果使用的是Gmail，那就可能需要该IP登录一次mail的web版，做了身份验证，才能正常使用.

好的，我再试试，插件没有问题，之前用的也是好的，我就是担心是否支持。  
插件支持20多个SMTP服务提供商  
Mailgun  
Mandrill  
SendinBlue  
SendGrid  
Elastic Email  
SparkPost  
Mailjet  
Gmail  
Amazon SES  
Hotmail  
Office365  
Zoho Mail

> **[Free email accounts with mail.com | Log in here or register today](https://www.mail.com/)**
>
> The right email address for you ✔ Secure ✔ 100+ domain names ✔ Up to 10 mail addresses ✔ Sync across devices ✔ 65GB email storage ✔ Sign up today!

Postmark  
1&1 Webmail  
AOL Mail  
Comcast  
GMX  
O2 Mail  
Orange  
Yahoo Mail  
Yahoo Mail Plus  
Yahoo AU/NZ  
AT&T  
NTL @ntlworld.com  
BT Connect  
Verizon  
BT Openworld  
O2 Online Deutschland  
Custom SMTP  
我也不知道是哪个。最后表示感谢！！

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 03:54 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/14 "2018-01-31T03:54:04Z")

</div>

> [@Shuai](#):
>
> 用的是哪个邮箱？

postfix courier，总监给我发的这个。能再帮忙看看吗？

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 08:30 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/15 "2018-01-31T08:30:40Z")

</div>

> [@huichen2017](#):
>
> Custom SMTP

你这是自建邮件服务器，选Custom SMTP

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年1 月 31 日 09:10 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/16 "2018-01-31T09:10:09Z")

</div>

> [@Shuai](#):
>
> 你这是自建邮件服务器，选Custom SMTP

估计smtp插件还是存在漏洞，用phpmailer测试该账号（没有用框架，纯测试账号）是可以发送的。

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 31 日 16:43 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/17 "2018-01-31T16:43:06Z")

</div>

smtp插件有好几个，你换其他的试试.

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年2 月 1 日 01:05 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/18 "2018-02-01T01:05:31Z")

</div>

> [@Shuai](#):
>
> smtp插件有好几个，你换其他的试试

好吧~搜索出来的基本上是mageplaza的这个插件，还是很好用的。

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年2 月 1 日 07:41 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/19 "2018-02-01T07:41:44Z")

</div>

我好像是用的这个:

> **[GitHub - magepal/magento2-gmail-smtp-app: Configure Magento 2 to send email...](https://github.com/magepal/magento2-gmail-smtp-app)**
>
> Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers - GitHub - magepal/mage...

名字有点像，但不是一个.

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年2 月 1 日 08:11 UTC](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300/20 "2018-02-01T08:11:24Z")

</div>

这个好像不支持25端口。  
发现插件其实没有问题：  
我在子站保存密码后一直发送失败，但是只要重新输入不保存就可以发送（why why why–我保证密码没有错误，但是保存前和保存后咋就不一样）？  
然后把主站也修改过来，保存后可以发送，再在子站测试又可以发送了，我真的很奇怪。

[下一页](https://forum.magentochina.org/t/m2%E4%BD%BF%E7%94%A8smtp%E6%8F%92%E4%BB%B6%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8A%A5authentication-failed%E9%94%99%E8%AF%AF%EF%BC%9F/300.md?page=2)
