As a webmaster you probably find yourself scrambling to complete various tasks to keep your site functional. While it’s easy to focus on visual items such as the design or enabling key functionality, many WordPress owners make the mistake of not connecting their sites to an SMTP server. Whether you’re intimidated by the thought of customizing your site or just haven’t thought of this aspect, SMTP can be integrated with ease through off the shelf plugins.
作为网站管理员,您可能会发现自己在争先恐后地完成各种任务,以保持网站的正常运行。 虽然很容易专注于视觉项目,例如设计或启用关键功能,但许多WordPress所有者却犯了一个错误,即未将其站点连接到SMTP服务器。 无论您是对自定义站点的想法感到害怕还是只是不考虑这一方面,都可以通过现成的插件轻松地集成SMTP。
内置的WordPress邮件功能 (The Built in WordPress Mail Function)
By default, WordPress comes with a built in mail function known as wp_mail
. This is a wrapper for PHP’s mail()
function which typically uses Sendmail for sending emails.
默认情况下,WordPress带有称为wp_mail
的内置邮件功能。 这是PHP的mail()
函数的包装程序,该函数通常使用Sendmail发送电子邮件。
Unless you edit the wp_mail
function, as discussed on the WordPress Codex, the default subject line for your messages will be “WordPress” and the default sender email address will be wordpress@yoursite.com.
除非您编辑WordPress Codex上讨论的wp_mail
函数,否则邮件的默认主题行将为“ WordPress”,默认发件人电子邮件地址为wordpress@yoursite.com。
Unfortunately on many WordPress websites, using the default mail server doesn’t work due to hosting restrictions (due to spam controls) or conflicts with other plugins. If you have a security plugin for example, those are known to be a major culprit of this function not working.
不幸的是,在许多WordPress网站上,由于托管限制(由于垃圾邮件控件)或与其他插件冲突,因此无法使用默认的邮件服务器。 例如,如果您有一个安全性插件,则已知是该功能无法正常工作的主要原因。
Rather than trying to troubleshoot wp_mail()
issues or having the default mail server stop working without your knowledge, it’s best to avoid using the wp_mail()
function as much as possible.
与其尝试解决wp_mail()
问题或让默认邮件服务器在您不知情的情况下停止工作,不如尽可能避免使用wp_mail()
函数。
WordPress SMTP集成 (WordPress SMTP Integration)
Below are a couple of leading solutions for replacing the default mail function on your site. Keep in mind that some online services such as Gmail place significant restrictions on allowing external sites to send email through their server. For the most part you’ll need to use a paid email provider (or the email server on your host) for this capability to work.
以下是一些领先的解决方案,用于替换您网站上的默认邮件功能。 请记住,某些在线服务(例如Gmail)对允许外部站点通过其服务器发送电子邮件设置了严格的限制。 在大多数情况下,您需要使用付费的电子邮件提供商(或主机上的电子邮件服务器)才能使用此功能。
WP邮件SMTP (WP Mail SMTP)
With over 300,000 active installs, WP Mail SMTP is one of the most popular external email tools on the WordPress codex. The tool simply reconfigures the wp_mail()
function to use SMTP instead of the PHP mail()
function and creates a control panel for you to enter your settings.
WP Mail SMTP具有超过300,000个活动安装,是WordPress Codex上最流行的外部电子邮件工具之一。 该工具只是将wp_mail()
函数重新配置为使用SMTP而不是PHP mail()
函数,并创建一个控制面板供您输入设置。
The plugin is designed to work with virtually any online email service as long as it supports SMTP.
该插件旨在支持几乎所有在线电子邮件服务,只要它支持SMTP。
![WP Mail SMTP](https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2015/04/1428331473WP-Mail-SMTP-1024x653.png)
简易WP SMTP (Easy WP SMTP)
Although it isn’t as popular as WP Mail SMTP, Easy WP SMTP has over 40,000 active installs. The plugin profile mentions that the tool is inspired by the WP Mail SMTP plugin however it doesn’t look like there are significant differences between the two.
尽管它不如WP Mail SMTP流行,但Easy WP SMTP具有40,000多个活动安装。 插件配置文件中提到该工具受WP Mail SMTP插件的启发,但是看起来两者之间没有显着差异。
![Easy WP SMTP](https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2015/04/1428331295Easy-WP-SMTP-1024x793.png)
特殊的电子邮件情况 (Specialized Email Situations)
Although integrating WordPress with a standard SMTP server is essential for administrative tasks, it isn’t ideal for all communication needs. Below are a couple of the most notable cases which fall under this umbrella:
尽管将WordPress与标准SMTP服务器集成对于执行管理任务是必不可少的,但这并不是满足所有通信需求的理想选择。 以下是此伞下最著名的几个案例:
交易电子邮件 (Transactional Email)
As discussed in a previous article on SitePoint, transactional email is an essential component for websites which need to send notifications to users. For example, eCommerce websites need to send order updates to customers while blogs and forums might alert users to replies on posts.
如上一篇有关SitePoint的文章所述, 交易电子邮件是需要向用户发送通知的网站的基本组件。 例如,电子商务网站需要向客户发送订单更新,而博客和论坛可能会提醒用户对帖子的回复。
In order to ensure that these emails get to your users, you should use a dedicated provider specializing in this space rather than traditional email systems. Two major players in this space are SendGrid and Mandrill.
为了确保这些电子邮件到达您的用户,您应该使用专门从事此领域工作的专用提供商,而不是传统的电子邮件系统。 这个领域的两个主要参与者是SendGrid和Mandrill 。
Both providers offer free plans with reasonable amounts of resources for many websites, and for those times when you’re running a larger scale property, the paid plans are relatively reasonable.
两家提供商都为许多网站提供了具有合理资源量的免费计划,而在您经营规模较大的物业时,付费计划是相对合理的。
电子邮件通讯 (Email Newsletters)
Similar to transactional email, if you run email marketing campaigns, these should not be done through a standard email server. This is because many shared hosts place significant restrictions on the amount of emails which can be sent per hour.
与交易电子邮件类似,如果您运行电子邮件营销活动,则不应通过标准电子邮件服务器来进行。 这是因为许多共享主机对每小时可以发送的电子邮件数量施加了很大的限制。
Users on virtual private servers (VPS) and dedicated systems aren’t subject to the same limits, but they can still risk having your IP address blacklisted, causing your emails to go into customer spam folders regardless of your content.
虚拟专用服务器(VPS)和专用系统上的用户不受相同的限制,但是他们仍然可能冒险将您的IP地址列入黑名单,从而使您的电子邮件进入客户垃圾邮件文件夹,而与您的内容无关。
Even if you have a dedicated IP address, there’s always the possibility the previous owner of the IP address used it for malicious purposes. Although it’s possible to remove the black marks against your server, the process requires a bit of effort and can take significant amounts of time.
即使您拥有专用的IP地址,该IP地址的先前所有者也始终有可能将其用于恶意目的。 尽管可以消除服务器上的黑色标记,但是此过程需要一些工作,并且可能会花费大量时间。
任何服务器都必须具备 (A Must Have for Any Server)
Even if you don’t plan on sending emails directly through WordPress, you should always link your WordPress site with an SMTP server it allows essential administrative notices to be sent to you.
即使您不打算直接通过WordPress发送电子邮件,也应始终将WordPress网站与SMTP服务器链接,该服务器可以将重要的管理通知发送给您。
There are plenty of plugins which conflict with the default WordPress mail function, and sometimes servers will block the php mailer function for security reasons. Considering the ease of implementing SMTP in WordPress, there’s almost no reason why you shouldn’t do this today.
有很多与默认WordPress邮件功能冲突的插件,有时出于安全原因服务器会阻止php mailer功能。 考虑到在WordPress中实现SMTP的简便性,几乎没有理由为什么您今天不应该这样做。
翻译自: https://www.sitepoint.com/reliable-wordpress-email-external-smtp-integration/