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.
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.
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 email@example.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.
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.
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.
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.
The plugin is designed to work with virtually any online email service as long as it supports 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.
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:
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.
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.
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.
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.
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.
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.
Learn PHP for free!
Make the leap into server-side programming with a comprehensive cover of PHP & MySQL.
RRP $11.95 Yours absolutely free
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.
Jump Start Git, 2nd Edition
Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers