One of the most commonly asked questions on WPBeginner is how to fix WordPress not sending email problem.


Many of our beginner level users ask us why their contact form plugin is not sending emails, or why they are not seeing any WordPress notifications.


In this article, we will show you how to fix the WordPress not sending email issue, so your website can send emails more reliably and bypass the spam folder.


How to fix the WordPress not sending email issue

为什么您没有从WordPress网站获取电子邮件 (Why You’re Not Getting Emails from Your WordPress Site)

The most common reason for emails going missing is that your WordPress hosting server is not properly configured to use the PHP mail() function.

电子邮件丢失的最常见原因是您的WordPress托管服务器未正确配置为使用PHP mail()函数。

Even if your hosting is configured to use it, many email service providers like Gmail and others use a variety of tools to reduce email spam. These tools try to detect that an email is really coming from the location that it claims to be from.

即使您的托管服务器配置为可以使用它,许多电子邮件服务提供商(例如Gmail和其他服务提供商)也会使用各种工具来减少电子邮件垃圾邮件 。 这些工具尝试检测电子邮件确实来自其声称来自的位置。

Emails sent by WordPress websites often fail this test.


This means that when an email is sent out from your WordPress site (contact form plugin, admin notification, etc), it may not even make it into the recipient’s spam folder let alone inbox.

这意味着当从您的WordPress网站发送电子邮件( 联系表单插件 ,管理员通知等)时,它甚至可能无法进入收件人的垃圾邮件文件夹,更不用说收件箱了。

This is why we recommend not using WordPress to send your email newsletter.


This is also the reason why we recommend everyone to use SMTP for sending emails in WordPress.


What is SMTP?


SMTP (Simple Mail Transfer Protocol) is the industry standard for sending emails.


Unlike the PHP mail() function, SMTP uses proper authentication which leads to high email deliverability.

与PHP mail()函数不同,SMTP使用适当的身份验证,这可以提高电子邮件的可传递性。

WordPress has a WP Mail SMTP plugin that configures your WordPress site to send emails using SMTP instead of the PHP mail() function.

WordPress具有WP Mail SMTP插件,该插件可将WordPress网站配置为使用SMTP而不是PHP mail()函数发送电子邮件。

You can use it to connect with any popular SMTP services like SendinBlue, Gmail (G Suite), Office365, Amazon SES, etc.

您可以使用它来连接任何流行的SMTP服务,例如SendinBlue,Gmail(G Suite),Office365,Amazon SES等。

With that said, let’s take a look at how to fix the WordPress not sending email issue.


安装WP Mail SMTP插件 (Installing the WP Mail SMTP Plugin)

Whatever SMTP service you choose, you’ll need to have the WP Mail SMTP plugin installed on your site. This lets you switch WordPress from using the built-in PHP mail() function to using your SMTP service.

无论选择哪种SMTP服务,都需要在您的站点上安装WP Mail SMTP插件。 这使您可以将WordPress从使用内置PHP mail()函数切换为使用SMTP服务。

First, install and activate the WP Mail SMTP plugin. If you’re not sure how, see our step by step guide on how to install a WordPress plugin.

首先,安装并激活WP Mail SMTP插件。 如果您不确定如何安装,请参阅我们的逐步指南, 了解如何安装WordPress插件

Next, click on WP Mail SMTP in your WordPress dashboard to configure the plugin settings.

接下来,在WordPress仪表板中单击WP Mail SMTP,以配置插件设置。

The WP Mail SMTP settings page in your WordPress dashboard

You will need to start by entering the name and business email address you want your site’s emails to come from. Make sure you use the same email address here that you’ll be using for your SMTP mailing service.

首先,您需要输入希望您的网站电子邮件来自的名称和公司电子邮件地址 。 确保您在此处使用与SMTP邮件服务相同的电子邮件地址。

Entering the name and email address that you want your WordPress emails to come from

You can choose to force emails to use this name and email address, even if other plugins (like WPForms) have different settings. WP Mail SMTP will override the other plugins’ settings.

您可以选择强制电子邮件使用此名称和电子邮件地址,即使其他插件(例如WPForms )具有不同的设置也是如此。 WP Mail SMTP将覆盖其他插件的设置。

After that, you need to choose a SMTP mailing service for your site.


For the sake of this tutorial, we’re going to setup SMTP using Sendinblue. If you’d prefer to use Gmail or Office365, then we’ve got instructions on those later in this article as well.

在本教程中,我们将使用Sendinblue设置SMTP。 如果您希望使用Gmail或Office365,那么我们还将在本文后面提供有关这些内容的说明。

Select Sendinblue as your mailer in WP Mail SMTP

To finish setting up WP Mail SMTP, you’ll need to create an account with Sendinblue. We’ll move on to that next, and then come back to finalizing the setup on WP Mail SMTP.

要完成WP Mail SMTP的设置,您需要使用Sendinblue创建一个帐户。 我们将继续进行下一步,然后返回完成WP Mail SMTP上的设置。

使用Sendinblue发送WordPress电子邮件 (Sending WordPress Emails using Sendinblue)

Sendinblue is a popular email service provider. They let you send a large number of emails with high deliverability.

Sendinblue是受欢迎的电子邮件服务提供商。 它们使您可以发送大量具有高传递性的电子邮件。

You can use Sendinblue to send up to 300 emails per day for free which is more than enough for most small websites.


These could be emails from your contact form, new user account details, password recovery emails, or any other emails sent through your WordPress site.


First, you’ll need to go to the Sendinblue website to create an account. Click the ‘Sign up free’ button to set up your account.

首先,您需要转到Sendinblue网站上创建一个帐户。 点击“免费注册”按钮来设置您的帐户。

Once you’ve created an account, you’ll see your Sendinblue dashboard. If you didn’t complete your profile during the setup stage, you’ll be prompted to do so here.

创建帐户后,您将看到Sendinblue仪表板。 如果您在设置阶段没有完成个人资料,则会在此处提示您完成个人资料。

The Sendinblue dashboard

Next, you’ll need to contact the support team to ask them to verify your account, so you can send emails through Sendinblue.


We recommend contacting the support team at this stage as it can take around 24 hours for them to verify your account. You can move on with the other steps while you’re waiting.

我们建议您在此阶段与支持团队联系,因为他们可能需要大约24小时才能验证您的帐户。 您可以在等待时继续执行其他步骤。

Go to sendinblue.com/contact and write a message that includes:


  • A request to activate your account

  • Your site’s URL

  • email newsletter, then you’ll need to state that you’ll be sending marketing emails too.电子邮件时事通讯 ,则需要声明您也将发送市场营销电子邮件。

Contact form message to Sendinblue to request account activation

You may be asked for further information. If not, you should receive an email from Sendinblue letting you know that your account has been approved.

可能会要求您提供更多信息。 如果没有,您应该收到来自Sendinblue的电子邮件,告知您您的帐户已被批准。

Once you’ve sent your message to the contact team, you can move on to add your domain name to the site.


Remember, you don’t need to wait for a reply before moving on with the next stage of this tutorial.


为您的网站设置子域 (Setting Up a Subdomain for Your Website)

First, you’ll need to set up a subdomain. This is like a separate section of your site. We suggest using mail1.yourdomain.com.

首先,您需要设置一个子域。 这就像您网站的单独部分。 我们建议使用mail1.yourdomain.com

Note: Your WordPress host may not allow you to use mail as your subdomain, which is why we’ve put the 1 in there too.


To add your subdomain, log in to your web hosting account and find the Domains section of your control panel.


For the sake of this tutorial, we’ll demonstrate how to do that on our example hosting account on Bluehost. After you login, go to Domains » Subdomains.

为了本教程的缘故,我们将在Bluehost的示例托管帐户上演示如何执行此操作。 登录后,转到“域»子域”

You can then type in your subdomain and click ‘Create’.


Adding a subdomain in WordPress

If you’re using other hosting companies or if your DNS is managed at domain registrar like Domain.com or GoDaddy, then follow their respective instructions.


After you have created the subdomain, you will need to add it in your Sendinblue account.


将您的子域添加到Sendinblue (Adding Your Subdomain to Sendinblue)

In your Sendinblue account, go to ‘Settings’ then find ‘Your Senders’ and click the ‘Configure’ button:


Configuring your sender settings in Sendinblue

Next, click on the ‘Domains’ tab and then click the ‘Add a New Domain’ button.


Adding a new domain in Sendinblue

Enter the entire subdomain (e.g. mail1.yoursite.com) and check the box next to “I would like to use this domain name to digitally sign my emails (SPF, DKIM, DMARC)”.


Add your subdomain and check the box

Next, click ‘Save’, and you’ll see a popup with several DNS records listed.


These lines of code let Sendinblue authorize your domain name.


Tip: Don’t worry if you close this popup by accident. You can get back to it by clicking the ‘Authenticate This Domain’ button next to your subdomain:

提示:如果您意外关闭此弹出窗口,请不要担心。 您可以通过点击子域旁边的“验证此域”按钮来重新获得它:

The Authenticate Domain button which lets you go back to the DNS settions

Open up a new browser tab and log back into your web hosting account. You need to find your domain and open up the DNS records.

打开一个新的浏览器选项卡,然后重新登录到您的虚拟主机帐户。 您需要找到您的域并打开DNS记​​录。

In Bluehost, you do this by going to Domains » My Domains then clicking ‘Manage’ next to your domain.

Bluehost中 ,您可以通过以下方法执行此操作:转到“域»我的域”,然后单击旁边的“管理”。

You’ll need to add 3 of TXT records provided by Sendinblue here.


First, scroll down to find the TXT section of your DNS records. It will look something like this:

首先,向下滚动以查找DNS记录的TXT部分。 它看起来像这样:

DNS TXT records in Bluehost

Then, click ‘Add Record’.


Complete the first record as follows:Host Record: mail._domainkey.mail1Record Type: TXTTXT Value: Copy this from Sendinblue.TTL: 1 day

完成以下第一条记录: 主机记录: mail._domainkey.mail1 记录类型: TXT TXT值:从Sendinblue复制。 TTL: 1天

Tips: Host Record might be called Host or Name by your web host. Change mail1 if you used something different for your subdomain. Record Type may not be required. TXT Value might also be called TXT data: it’s the first, long piece of code in the Sendinblue details. TTL could be 24 hours or 86400 seconds (both are equivalent to 1 day). If you’re using GoDaddy, set it to 1 hour.

提示:主机记录可能被您的Web主机称为“主机”或“名称”。 如果您在子域中使用了其他内容,请更改mail1 。 记录类型可能不是必需的。 TXT值也可以称为TXT数据:它是Sendinblue详细信息中的第一段很长的代码。 TTL可能是24小时或86400秒(两者都等于1天)。 如果您使用的是GoDaddy ,请将其设置为1小时。

Once you have added the first record, click ‘Save’.


Next, you need to add the second record. Complete it as follows:

接下来,您需要添加第二条记录。 如下完成它:

Host Record: mail1Record Type: TXTTXT Value: v=spf1 include:spf.sendinblue.com mx ~allTTL: 1 day

主机记录: mail1 记录类型: TXT TXT值: v=spf1 include:spf.sendinblue.com mx ~all TTL: 1天

Once you’re done, click ‘Save’.


After saving that, you need to add the third record. Complete it as follows:

保存后,您需要添加第三条记录。 如下完成它:

Host Record: mail1Record Type: TXTTXT Value: Copy this from Sendinblue. It’s the third piece of code.TTL: 1 day

主机记录: mail1 记录类型: TXT TXT值:从Sendinblue复制。 这是第三段代码。 TTL: 1天

Once you’re done, go ahead and save that record too.


Warning: Sendinblue also has a fourth piece of code for a DMARC record. You don’t need this, and we strongly recommend skipping it unless you’re experienced with DMARC configuration.

警告: Sendinblue还有DMARC记录的第四段代码。 您不需要它,我们强烈建议您跳过它,除非您有DMARC配置的经验。

After you’ve added your records, go back to Sendinblue. For each record, click the button ‘Record Added. Please Verify It.’ It may take 24-48 hours before Sendinblue is able to verify your records, but it’s often much quicker.

添加记录后,请返回Sendinblue。 对于每条记录,单击“添加记录”按钮。 请验证。” Sendinblue可能需要24-48小时才能验证您的记录,但是通常要快得多。

If nothing happens when you click that button, the records can’t yet be verified. Check again later and see if they’ve been verified. Once they have, you’ll see the word ‘Configured’ next to the records in green:

如果单击该按钮时没有任何React,则该记录尚无法验证。 稍后再检查,看看是否已通过验证。 一旦有了它们,您将在绿色的记录旁边看到“已配置”一词:

Sendinblue DNS TXT records once they've been verified

You can keep going with this tutorial while you wait for the verification to take place.


完成设置WP邮件SMTP以使用Sendinblue (Finishing Setting Up WP Mail SMTP to Use Sendinblue)

Go back to your WP Mail SMTP settings in your WordPress dashboard. You should have already entered the From Email and From Name, but if not, you can do that now.

返回到WordPress仪表板中的WP Mail SMTP设置。 您应该已经输入了“发件人电子邮件”和“发件人姓名”,但是如果没有,则可以立即输入。

Leave the ‘Return Path’ checkbox unchecked as this option isn’t used by Sendinblue.


Next, click on ‘Sendinblue’ for your mailer.

接下来,为您的邮件单击“ Sendinblue”。

Select Sendinblue as your mailer in WP Mail SMTP

You’ll need go to your Sendinblue account to find your API key. Just click on the link below the ‘API Key’ box and your Sendinblue account dashboard will open up at the right place, in a new tab.

您需要进入您的Sendinblue帐户以找到您的API密钥。 只需单击“ API密钥”框下方的链接,您的Sendinblue帐户信息中心将在正确的位置打开一个新标签。

Copy the v3 API key from this page.

从此页面复制v3 API密钥。

Getting the API from Sendinblue

Congratulations. You’ve now set everything up. The final step is to send a test email to make sure everything is working.

恭喜你 现在,您已经完成了所有设置。 最后一步是发送测试电子邮件,以确保一切正常。

Go to the ‘Email Test’ tab of WP Mail SMTP and enter an email address to send an email to. This will default to the site’s admin email. Click ‘Send Email’.

转到WP Mail SMTP的“电子邮件测试”标签,然后输入要发送电子邮件的电子邮件地址。 这将默认为网站的管理员电子邮件。 点击“发送电子邮件”。

You should see the message ‘Test HTML email was sent successfully!’ Check your inbox to see whether it’s arrived. It’ll look like this:

您应该看到消息“测试HTML电子邮件已成功发送!” 检查您的收件箱,看它是否到达。 它看起来像这样:

The test email from WP Mail SMTP

Note: If your Sendinblue account isn’t yet activated, you’ll get the message: [permission_denied]: Unable to send email. Your SMTP account is not yet activated.

注意:如果尚未激活您的Sendinblue帐户,则会收到以下消息: [permission_denied]: Unable to send email. Your SMTP account is not yet activated [permission_denied]: Unable to send email. Your SMTP account is not yet activated

解决WordPress电子邮件问题的其他方法 (Alternative Ways to Fixing WordPress Email Issue)

As you can see from the WP Mail SMTP plugin’s list of mailer options, you don’t have to use Sendinblue. While it’s our top free recommendation, there are other options that you can use including Office 365, Gmail / G Suite, Amazon SES, etc.

WP Mail SMTP插件的邮件程序选项列表中可以看到,您不必使用Sendinblue。 虽然这是我们的最佳免费推荐,但您还可以使用其他选项,包括Office 365,Gmail / G Suite ,Amazon SES等。

Using Gmail or G Suite with WP Mail SMTP to Fix WordPress Emails

结合使用Gmail或G Suite和WP Mail SMTP修复WordPress电子邮件

If you have a Gmail or G Suite account, then you can use that to send your emails. You won’t need to enter your email login details in WordPress when you’re using the WP Mail SMTP plugin.

如果您拥有Gmail或G Suite帐户,则可以使用该帐户发送电子邮件。 使用WP Mail SMTP插件时,无需在WordPress中输入电子邮件登录详细信息。

To use Gmail or G Suite, set up WP Mail SMTP as shown above, and then click the ‘Google’ option for your mailer.

要使用Gmail或G Suite,请如上所述设置WP Mail SMTP,然后单击邮件的“ Google”选项。

You will need to check the ‘Return Path’ box.


After that you will be asked to enter a ‘Client ID’ and ‘Client Secret’. To get these details, you’ll need to create a web application in your Google account. Don’t worry if that sounds a bit daunting. You can find full instructions in this article on using Gmail to send your WordPress emails.

之后,将要求您输入“客户端ID”和“客户端密码”。 要获取这些详细信息,您需要在Google帐户中创建一个网络应用程序。 如果这听起来有些令人生畏,请不要担心。 您可以在本文中找到有关使用Gmail发送WordPress电子邮件的完整说明。

Note: You can use this process with a regular Gmail account, but your email deliverability will be much better if you are using G Suite. See our guide on how to setup a professional email address with Gmail and G Suite.

注意:您可以对普通的Gmail帐户使用此过程,但是如果使用G Suite,则电子邮件的可传递性会更好。 请参阅我们的指南,了解如何使用Gmail和G Suite设置专业的电子邮件地址

There are a couple of key drawbacks to using Gmail or G Suite, however.

但是,使用Gmail或G Suite有两个主要缺点。

One is that you may need to contact your web host to get them to install the right certificate to get it working.


Another is that if you change the email address in the future, you’ll need to go through the entire process again. This will include creating a new web application.

另一个问题是,如果您以后更改电子邮件地址,则需要再次执行整个过程。 这将包括创建一个新的Web应用程序。

Using Office 365 / Outlook with WP Mail SMTP to Fix WordPress Emails

使用Office 365 / Outlook与WP Mail SMTP修复WordPress电子邮件

If you use Microsoft Office 365 or Outlook for your regular email account, then you can also use that to send out emails through WordPress. This isn’t a recommended option, though, because it’s less secure.

如果您将Microsoft Office 365或Outlook用作常规电子邮件帐户,则也可以使用它通过WordPress发送电子邮件。 但是,由于安全性较低,因此不建议使用此选项。

You’ll need to set up WP Mail SMTP as above, then click the ‘Other SMTP’ option. This will open up a form to complete. Fill it out using the following settings:

您需要如上所述设置WP Mail SMTP,然后单击“其他SMTP”选项。 这将打开一个表格来完成。 使用以下设置填写:

SMTP Host: smtp.office365.com
Encryption: TLS
SMTP Port: 587
Auto TLS: (leave switched on)
Authentication: (leave switched on)
SMTP Username: Your Office 365 account email address
SMTP Password: Your Office 365 account password

自动TLS :(保持打开状态)
SMTP用户名:您的Office 365帐户电子邮件地址
SMTP密码:您的Office 365帐户密码

A key problem with this method is that it requires storing your password in plain text within WordPress. This isn’t secure and your password will be visible to any other administrators on your account. You can use the instructions in the WP Mail SMTP app to record it in your wp-config.php file instead.

这种方法的一个关键问题是,它需要将密码以纯文本格式存储在WordPress中。 这是不安全的,您帐户上的其他任何管理员都可以看到您的密码。 您可以使用WP Mail SMTP应用程序中的说明将其记录在wp-config.php文件中。

For more details, see the detailed guide on how to setup Outlook with WP Mail SMTP.

有关更多详细信息,请参阅有关如何使用WP Mail SMTP设置Outlook的详细指南。

Using Amazon SES with WP Mail SMTP to Fix WordPress Emails

将Amazon SES与WP Mail SMTP结合使用以修复WordPress电子邮件

Amazon AWS platform has a Simple Email Service (SES) that you can use to fix the WordPress email issue.

Amazon AWS平台具有简单电子邮件服务(SES),可用于修复WordPress电子邮件问题。

The best part about Amazon is that it lets you send up to 62,000 emails every month for free. The downside is that the setup is a bit more challenging for beginners which is why we don’t recommend it as our preferred option.

关于Amazon最好的部分是它可以让您每月免费发送多达62,000封电子邮件。 不利的一面是,对于初学者而言,该设置更具挑战性,这就是为什么我们不建议您将其作为首选的原因。

But as you can imagine, a lot of professionals and experts use Amazon SES for their WordPress email SMTP service, so we couldn’t write an article without mentioning it.

但是正如您可以想象的那样,许多专业人士和专家都将Amazon SES用于其WordPress电子邮件SMTP服务,因此我们不能不提及就撰写文章。

If you’r interested in setting up Amazon SES with WordPress, then see the full instructions on how to setup Amazon SES with WordPress.

如果您有兴趣使用WordPress设置Amazon SES,请参阅有关如何使用WordPress设置Amazon SES的完整说明。

Whatever mailer you decide to use, always remember to use the ‘Test Email’ tab to ensure that emails are being successfully sent.


You must make sure to check your inbox too, and confirm that you’ve received the test email.


We hope this article helped you learn how to fix WordPress not sending email issue. You may also want to see our list of the most common WordPress errors and how to fix them.

我们希望本文能帮助您学习如何修复WordPress不发送电子邮件的问题。 您可能还想查看我们最常见的WordPress错误列表以及如何修复它们

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-fix-wordpress-not-sending-email-issue/


  • 0
  • 0
  • 0
  • 一键三连
  • 扫一扫,分享海报

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2021 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
钱包余额 0