What does SMTP stand for?
SMTP stands for: Simple Mail Transfer Protocol
In layman’s terms: it’s the technology that allows your website to send email messages
To learn more about how it works, head on over to this Wikipedia article: https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
Why use an SMTP service
Most modern websites, especially WordPress sites, use email to send transactional messages.
Even if you don’t have a contact form on your website, or aren’t powering a newsletter with it, you may still want to have the ability for your WordPress site to be able to send email notifications.
For example, you might get email notifications for:
- Password reset links
- Automatic Upgrade notifications
- Digest emails (i.e. security plugin stats)
- And user login/creation notifications
Some web hosts include an email function (PHP Mailer) built-in. So you might not ever have to worry about setting up an SMTP service
If you’re wondering what a “Transactional Email” is, it’s basically an automated email that is sent to one person notifying them about something. For example, a “password reset” email is a transactional email.
It’s especially important when running a WordPress Multisite Network to have email capabilities for transactional emails. Because your website will be sending you notifications about new users, and new sites, as well as the other standard notifications.
Not using SMTP: Email Capability On The Server
Some web hosts provide an email service already installed on the server. Which means you don’t need to setup a SMTP service or plugin on your website.
For the most part, this is OK to use. However, as modern spam preventions evolve, these services don’t simple work “out of the box” anymore.
If you choose to go this route, you should also consider setting up rDNS records, editing your server’s hosts file, as well as adding DKIM and SPF records to your website URL’s DNS records. The reason this has become so complex? Spammers. We now have to have these things in place so that spammers can’t just set up a new server and begin sending out thousands of emails without going through the proper checks first.
If setting up server mailer services sounds complicated, it’s because it requires knowledge of servers, DNS records, and is a more technical solution than using a SMTP plugin. So, for the scope of this article, we won’t go into it yet (maybe in a future article).
So, using a 3rd part SMTP service with a SMTP plugin on your WordPress Multisite Network is usually the more popular choice.
To get started, you will need a free account with a 3rd party SMTP service.
Luckily, these are usually free to get started with.
3rd Party SMTP Service Options
There are many SMTP services out there, so this article won’t go into detail for setting them up. But here are a few I’m familiar with:
- MailGun.com
- SendGrid.com
- Gmail (yes, you can use your gmail account as a SMTP service, with limitations on number of emails sent per day).
- Ask Google for more options by clicking here
Choose one you like, and sign up on their homepage (if you’d like me to go into more details on signing up for these services, please let me know in the comments).
Choosing the right SMTP Plugin
WordPress is one of the most popular website content management systems in the world, so naturally there are a ton of SMTP plugins to choose from.
The SMTP Plugin I prefer to use for WordPress Multisite is WP Mail SMTP by WP Forms.
However, for standalone wordpress sites I prefer FluentSMTP. It’s FREE, and comes with features like email logging, multiple SMTP hosts, and more: https://wordpress.org/plugins/fluent-smtp/
But there are many others which will also work just fine.
The main reason I use WP Mail SMTP for WordPress Multisite is the ability to add parameters to your wp-config.php file which makes setting up global configurations easy. Plus, it is well supported, has over 1,000 5-star ratings, and they take security into consideration by using API’s instead of username/password credentials when connecting to your SMTP service.
You are welcome to choose a different plugin that suits your specific needs.
Setting up WP Mail SMTP for WordPress Multisite
Note: This also works for a non-multisite install (a.k.a. regular WordPress site).First, make sure you’ve registered for a free account at one of the SMTP services listed above (I’m using MailGun). And have your API key handy.
Next, install the WP Mail SMTP plugin by logging into your WordPress site and going to Plugins > Add New. “Search the repository for SMTP).
Choose “Network Activate” (in the photo below, we’ve already activated the plugin).
To set the settings for your entire network, you’ll need to edit your wp-config.php
file. This handy snippet gets you 90% of the way there. Just fill in the blanks with the info from your Mailgun account:
/**
* WP SMTP Mail by WPForms
*
* Specifically aimed at WP Multisite users.
* Values from constants are NOT stripslash()'ed.
*/
define( 'WPMS_ON', true ); // True turns on the whole constants support and usage, false turns it off.
define( 'WPMS_MAIL_FROM', '' );
define( 'WPMS_MAIL_FROM_FORCE', true ); // True turns it on, false turns it off.
//define( 'WPMS_MAIL_FROM_NAME', '' );
//define( 'WPMS_MAIL_FROM_NAME_FORCE', true ); // True turns it on, false turns it off.
define( 'WPMS_MAILER', '' ); // Possible values: 'mail', 'gmail', 'mailgun', 'sendgrid', 'smtp'.
define( 'WPMS_SET_RETURN_PATH', true ); // Sets $phpmailer->Sender if true.
define( 'WPMS_MAILGUN_API_KEY', '' );
define( 'WPMS_MAILGUN_DOMAIN', '' );
define( 'WPMS_MAILGUN_REGION', 'US' ); // or 'EU' for Europe.
/* End WP SMTP Mail by WPFORMS */
After you do this, make sure to send a test email to be sure everything is working!
Summary
We looked at setting up a SMTP plugin for WordPress multisite using the WP Mail SMTP Plugin, and adding some code to our wp-config.php file.
Now, every time your website needs to send a transactional email (i.e. a notification that someone filled out your contact form) instead of using the server to send the email, it will use MailGun.com’s email service.
The main advantage of doing this is that your emails won’t be blocked by spam blockers, though they will show up in the “promotions” tab of your gmail inbox.
You can then log into your account at MailGun.com and see charts and statistics about how many emails your server is sending.
What is your preferred method for setting up SMTP on your WordPress site? I’d love to hear your thoughts! Please leave a comment below to share – thanks!