Are you having trouble receiving or sending emails from your WordPress site? One solution for that is to use third party email services such as Mailgun. However, these services will cost you extra money. In this article, we will show you how to use a SMTP server to send WordPress emails.

您是否无法从WordPress网站接收或发送电子邮件? 一种解决方案是使用第三方电子邮件服务,例如Mailgun。 但是,这些服务将花费您额外的钱。 在本文中,我们将向您展示如何使用SMTP服务器发送WordPress电子邮件。

Using SMTP Server to Send WordPress Emails

WordPress电子邮件的问题 (The Problem with WordPress Emails)

WordPress uses mail function in PHP to send emails. Many shared hosting providers do not have this function configured properly, or they have disabled it entirely to avoid abuse. In either case, this causes your WordPress emails to not be delivered.

WordPress在PHP中使用邮件功能来发送电子邮件。 许多共享主机提供商未正确配置此功能,或者已完全禁用此功能以避免滥用。 无论哪种情况,这都会导致您的WordPress电子邮件无法发送。

The alternative solution is to use a third party email service to send out your emails. You can use services like Mailgun, Google Apps for work, or Sendgrid.

另一种解决方案是使用第三方电子邮件服务发送您的电子邮件。 您可以使用Mailgun,Google Apps for Work或Sendgrid等服务。

You will have to pay for your account, and the cost will vary depending on how many users/accounts you add or the number of emails you send. See our tutorial on how to fix WordPress not sending email issue.

您将需要为您的帐户付款,费用将根据您添加的用户/帐户数量或发送的电子邮件数量而有所不同。 请参阅我们的教程,了解如何解决WordPress不发送电子邮件的问题

What if we told you that there is another option, and most likely you are already paying for it?


影片教学 (Video Tutorial)


If you don’t like the video or need more instructions, then continue reading.


通过主机使用电子邮件帐户 (Using Email Accounts by Your Host)

Most WordPress hosting providers offer email services for each domain you host with them. This means you can create email accounts with your own domain name like yourname@yoursite.com.

大多数WordPress托管提供商都为您托管的每个域提供电子邮件服务。 这意味着您可以使用自己的域名(例如yourname@yoursite.com创建电子邮件帐户。

First you will need to create an email account. For the sake of this example, we will show you how to create an email account in cPanel. Your hosting service provider may use some other account management system, but the basic process is the same on most hosting services.

首先,您需要创建一个电子邮件帐户。 为了这个示例,我们将向您展示如何在cPanel中创建电子邮件帐户。 您的托管服务提供商可能会使用其他帐户管理系统,但是大多数托管服务的基本过程是相同的。

Log into your hosting account, and click on email accounts under the mail section.


Email accounts

This will show you a simple form where you need to fill out information required to create your email account.


Since we will be using this account to send WordPress emails, we recommend that you create an email account like wordpress@example.com. Make sure to replace example.com with your own domain name.

由于我们将使用此帐户发送WordPress电子邮件,因此建议您创建一个电子邮件帐户,如wordpress@example.com 。 确保用您自己的域名替换example.com。

Creating email account in cPanel

After creating your email account, you are now ready to use it in WordPress. But before you do that, you will need the following information from your hosting service provider.

创建电子邮件帐户后,您现在就可以在WordPress中使用它了。 但是在您这样做之前,您需要从托管服务提供商处获得以下信息。

  1. SMTP Host for your email address.

  2. SMTP Port for secure login.


You can check the support section on your host’s website for this information. Most likely there will be an article providing this information. If you don’t find it, then you should contact the hosting support to request this information.

您可以查看托管人网站上的支持部分以获取此信息。 很可能会有一篇文章提供此信息。 如果找不到,则应联系托管支持以请求此信息。

在WordPress中使用您的品牌电子邮件地址 (Using Your Branded Email Address in WordPress)

You will now need to install and activate the WP Mail SMTP plugin. For more details, see our step by step guide on how to install a WordPress plugin.

现在,您将需要安装并激活WP Mail SMTP插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to visit Settings » Email to configure the plugin settings.


WP-Mail-SMTP Settings

First you need to enter the email address you just created. After that you can add a from name, this will be used as the sender name.

首先,您需要输入刚创建的电子邮件地址。 之后,您可以添加一个发件人名称,它将用作发件人名称。

If you do not add a from name, then the plugin will use the default WordPress.

如果您没有添加“ from”名称,则该插件将使用默认的WordPress。

Next, you need to choose the mailer. Go ahead and click on the ‘Other SMTP’ option to select it.

接下来,您需要选择邮件程序。 继续并单击“其他SMTP”选项以将其选中。

Choose Mailer

After that, you need to check the box next to ‘Return Path’ option. This option sets the return path to match the sender email address. If you leave it unchecked, bounced messages and non-delivery receipts will be lost.

之后,您需要选中“返回路径”选项旁边的框。 此选项设置返回路径以匹配发件人电子邮件地址。 如果不选中它,退回邮件和未送达回执将丢失。

Next, you need to set up SMTP options.


SMTP settings

First you need to enter your SMTP host and port. You can obtain this information from your hosting provider. Typically, SMTP host is mail.yourdomain.com (replace yourdomain.com with your own domain name). For SMTP Port 465 is commonly used.

首先,您需要输入SMTP主机和端口。 您可以从托管服务提供商处获取此信息。 通常,SMTP主机是mail.yourdomain.com(用您自己的域名替换yourdomain.com)。 对于SMTP,通常使用端口465。

Next, you need to choose encryption. Most WordPress hosting companies support SSL and TLS. We recommend using TLS option when available.

接下来,您需要选择加密。 大多数WordPress托管公司都支持SSL和TLS。 我们建议使用TLS选项(如果可用)。

After that turn on the authentication toggle and provide your SMTP username and password. Normally, your email address is also your SMTP username.

之后,打开身份验证切换并提供您的SMTP用户名和密码。 通常,您的电子邮件地址也是SMTP用户名。

Your password is stored as plain text, which is not safe. Don’t worry, we will show you how to make more secure later in this article.

您的密码以纯文本格式存储,因此不安全。 不用担心,我们将在本文后面向您展示如何提高安全性。

Don’t forget to click on the save settings button to store your changes.


测试您的SMTP设置 (Testing Your SMTP Settings)

Now that you have set up WP Mail SMTP to send emails, let’s test if everything is working fine. On the plugin’s settings page, click on the ‘Email Test’ tab.

现在,您已经设置了WP Mail SMTP发送电子邮件,让我们测试一下一切是否正常。 在插件的设置页面上,单击“电子邮件测试”选项卡。

Send test email

You need to provide an email address where you would like to receive test email. This could be any valid email address that you can access. After that click on the Send Email button to continue.

您需要提供一个电子邮件地址,您想在其中接收测试电子邮件。 这可以是您可以访问的任何有效电子邮件地址。 之后,单击发送电子邮件按钮继续。

WP Mail SMTP will now send an email message using the SMTP settings you entered earlier. You will see a success message when email is sent successfully.

WP Mail SMTP现在将使用您先前输入的SMTP设置发送电子邮件。 成功发送电子邮件后,您将看到一条成功消息。

保护您的电子邮件密码 (Securing Your Email Password)

You may need to enter your email account password in WP MAIL SMTP settings. This password is normally stored as plain text which is unsafe.

您可能需要在WP MAIL SMTP设置中输入您的电子邮件帐户密码。 该密码通常以纯文本格式存储,这是不安全的。

However, the plugin also provides you an option to make it more secure. To do that, you will need to add some code to your wp-config.php file. If you haven’t done this before, then please see our guide on how to edit wp-config.php file in WordPress.

但是,该插件还为您提供了使其更安全的选项。 为此,您将需要在wp-config.php文件中添加一些代码。 如果您之前没有做过,请参阅我们的指南, 了解如何在WordPress中编辑wp-config.php文件。

First you will need to connect to your website using a FTP client or File Manager app in cPanel. Once connected, you will find your wp-config.php file in the root folder of your website.

首先,您需要使用cPanel中的FTP客户端或文件管理器应用程序连接到您的网站。 连接后,您将在网站的根文件夹中找到wp-config.php文件。

You can edit this file using any plain text editor like Notepad or TextEdit.


Locate the line that says ‘That’s all, stop editing! Happy blogging’ and add the following code just before it.

找到说“就这样,停止编辑! 祝您博客愉快”,并在其之前添加以下代码。

define( 'WPMS_ON', true );
define( 'WPMS_SMTP_PASS', 'your_password' );

Don’t forget to replace ‘your_password’ with your actual SMTP password. After that, save and upload your wp-config.php file back to server.

不要忘记用您的实际SMTP密码替换“ your_password”。 之后,保存您的wp-config.php文件并将其上传回服务器。

You can now visit your WordPress admin area and go to Settings » WP Mail SMTP page. Scroll down to the SMTP options section and you will see password field is now disabled.

现在,您可以访问WordPress管理区域,然后转到“设置”»“ WP Mail SMTP”页面。 向下滚动到“ SMTP选项”部分,您将看到密码字段现已禁用。

SMTP password disabled

对WordPress电子邮件问题进行故障排除 (Troubleshooting WordPress Email Issues)

The most common reason for errors in sending emails using SMTP is incorrect SMTP host or port. Make sure that you are entering the correct host and port settings provided by your hosting provider.

使用SMTP发送电子邮件时出错的最常见原因是不正确的SMTP主机或端口。 确保您输入的是主机提供商提供的正确的主机和端口设置。

Make sure that you select the correct encryption method. Usually SSL works on most environments, but we recommend that you check with your web host if your emails are not getting delivered.

确保选择正确的加密方法。 SSL通常可在大多数环境中使用,但是如果您的电子邮件没有发送,我们建议您与Web主机联系。

将Web主机的邮件服务器用于WordPress电子邮件的利弊 (Pros and Cons of Using Your Web Host’s Mail Servers for WordPress Emails)

First and the most obvious advantage is that you can use your own branded email address for outgoing emails in WordPress.


Another advantage is that you have already paid for this service when signing up for your hosting account. You will not need to pay any extra money for sending and recieving emails.

另一个好处是,您在注册主机帐户时已经为该服务付费。 您无需为发送和接收电子邮件支付任何额外的费用。

However, some WordPress hosting providers enforce limitations on outgoing emails. This is why we don’t recommend using WordPress to send newsletter emails.

但是,某些WordPress托管服务提供商对外发电子邮件实施限制。 这就是为什么我们不建议使用WordPress发送时事通讯电子邮件的原因

Another common problem with shared hosting providers is that their mail servers can be quite unreliable at times. If you notice delays in email delivery, then you should consider using third party email services like Google Apps for Work, Mailgun, or SendGrid.

共享主机提供商的另一个常见问题是,有时它们的邮件服务器可能非常不可靠。 如果您发现电子邮件发送延迟,则应考虑使用第三方电子邮件服务,例如Google Apps for Work ,Mailgun或SendGrid。

We hope this article helped you learn how to use SMTP server to send WordPress emails. You may also want to see our list of the must have WordPress plugins for businesses.

我们希望本文能帮助您学习如何使用SMTP服务器发送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-use-smtp-server-to-send-wordpress-emails/


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

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