How to Send WordPress Email with External SMTP Server

By default, WordPress itself does not provides External SMTP settings to send its email. This is especially troublesome if you often send emails to communicate with your customers via WooCommerce platform, members or notice to user via BBPress forum. Oftentimes, the build-in email function known as wp_mail() is not sufficient for users as emails either don’t send at all or have a high likelihood of winding up caught in spam filters. Due to the nature of PHP Mail function emails often arrive in spam / junk folder. When sending email, it is usually a good idea to Send WordPress Email with External SMTP.
In this post, I’ll show you how to increase the deliverability of emails sent by WordPress using something called SMTP.
In my experience, the build-in PHP mail works most of the time. Unfortunately on many Web Hosting Providers, they apply strict limitations or even completely disable PHP Mail function. Because there are actually various types of providers that can provide you with a free SMTP server. But, Gmail’s free SMTP server still works great for a lot of people! You are not paying anything and still, you are using a service, which sounds great if you are just starting your business, where your budget is close to zero.

Why You Need to Send WordPress Email with External SMTP

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. That’s why a free third party SMTP server (not self-host SMTP server) is a far better alternative.
Having access to an external SMTP server has a couple of benefits.

  • simple to set up and configure.
  • successfully deliver your emails to your subscribers’ inbox (very important)
  • allow developers to save costs & time setting up their own servers.
  • no need to tune your mail server.
  • you have a secure (and searchable!) backup of your emails on SMTP servers.
  • no need to clean up your database from the customers’ email addresses.
  • no need to make any special tweaks in your application code.
  • can be used for both development and staging purposes.
  • able to set up a branded email for outgoing WordPress emails like [email protected], it is nice to add a bit of personalization.
  • an SMTP Service That is scalable in future. Did you know that you can also send and receive emails from custom domains within Gmail? They provide G Suite email service with just $5 per month.

There are two ways that you can send mail from WordPress with an external SMTP server:

  1. Use a WordPress plugin (the easiest way)
  2. Manual SMTP Settings for WordPress – Without Using Plugin

SMTP Sending Limit

Keep in mind that some online services such as Gmail place significant restrictions on allowing external sites to send email through their server. After you reach the limit, you won’t be able to send more emails for the next 24 hours.

  • Google’s free service does have a daily sending limit by POP or IMAP users or the Gmail API —it is 2,000 (500 for trial accounts) emails per day, 100 people per connection.
  • The Outlook 365: 300 emails per day, 30 per minute, and up to 100 recipients per email.
  • Yahoo SMTP sending limits: 500 emails per day, each message can be sent to, at most, 100 recipients.
  • Yandex.Mail for domains: You can send 3000 * emails from one mailbox in a 24-hour period. If you entered several recipients, a separate email is sent to each of them.
  • Zoho Free Edition Limits: 50 x total confirmed and active users (per day, per organization) for upto 4 users. For accounts with more than 4 users, the limit is 200 emails (per day, per organization).

Although the free service has a sending limit, it’s an excellent solution if you don’t want to send a huge amount of emails.

IMPORTANT! Before proceeding, make sure SMTP is supported by your hosting provider.

Method #1: Use a plugin to send mail from WordPress with an external SMTP server

SMTP can be integrated with ease through off the shelf plugins, WordPress even has SMTP plugins such as WP Mail SMTP by WPForms, Easy WP SMTP or Post SMTP Mailer/Email Log for this purpose. The chocies on this list include the most versatile features, easiest setups, and most afforable plugins. As far as I know, WP Mail SMTP by WPForms is the most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites.

WP Mail SMTP by WPForms
WP Mail SMTP by WPForms

Here’s why I recommend this plugin:

  • With over 1+ Million Active Installations, it’s very popular plugin.
  • WP Mail SMTP plugin includes many different SMTP setup options: Gmail, Mailgun, SendGrid and All Other SMTP with a very easy set up wizard.
  • You don’t need to store your email account password, it uses app API Keys or OAuth to authenticate your account, keeping your login info secure..
  • Easy testing & debuging sending process, see the exact cause of failed emails.
  • Supports forced From Email to ignoring values set by other plugins.

In the next step, this article walks you through how to configure this plugin.
Step 1 – Basic information
Get started by installing and activating the plugin. Once activated, navigate to Settings ➡️ WP Mail SMTP in the menu on the left of your WordPress administration dashboard.

WP Mail SMTP settings
WP Mail SMTP settings

Then fill in the following fields:

  • From Email – Enter the email you wish to send FROM. This will be what people see when they receive your message.
  • Force From Email – Check this box
  • From Name – Enter a name you’d like to appear as being sent FROM
  • Force From Name – Check this if you wish to force the FROM name
  • Mailer – Choose ‘Other SMTP’
  • Return Path – Check this box

Step 2 – Config the mailer
Scroll down to the next section. As you see on the image above, the FREE version of WP Mail SMTP has five options to setup the mailer: Build-in PHP function, Gmail, Mailgun, Sendgrid, and Other SMTP. Choose your SMTP service then fill all the require fields following their guidline.
Gmail Setup in WP Mail SMTP
The steps are similar to those described above, and you just need to configure the settings as per the SMTP provider.
Step 3 – Test your email
Scroll to the top and click the ‘Email Test’ tab. Click the Send Email button to test. If everything went well, you should receive an email at the email address you entered. As long as you get the email, SMTP is properly configured!
Send test email

WP Mail SMTP Pro

Congratulations – you have found our exclusive coupon: SAVE20 to get 20% off any of their plans: $49 now is $24.9/year.

GET WP Mail SMTP PRO NOW

If you want more, then try out Pro version of WP Mail SMTP. In addition to native Microsoft and Amazon SES integrations, it provides access to many other powerful features and services.

  • White Glove Setup: Allow their experts to install and configure WP Mail SMTP for you.
  • Email Log: Keep track of every email sent from your WordPress site.
  • Manage Notifications: Control which email notifications your WordPress site sends.
  • Send emails using: Office 365, Outlook.com, Amazon SES mailers.
  • Access to their world class one-on-one email support is available to WP Mail SMTP Pro users.

Method #2: Manual SMTP Settings for WordPress – Without Using Plugin

You want to send email with external SMTP server BUT you hate plugin bloat. Instead of using a third-party plugin to handle e-mail for your site, you can use the WordPress API to develop your own custom code. The easiest way to set up SMTP is to add this snippet to your functions.php or wp-config.php file, this will ensure that WordPress uses SMTP instead of the standard PHP Mail.

  1. Add following code to your wp-config.php file (above ‘’ Happy blogging ‘’ field) and edit it according to smtp authentication of your mail:
  2. // Ensure that, your wp-config.php file is not accessible. Because this keeps it away from prying eyes.
     // SMTP Authentication
        define('SMTP_USER',   '[email protected]');    // Username to use for SMTP authentication
        define('SMTP_PASS',   'smtp password');       // Password to use for SMTP authentication
        define('SMTP_HOST',   'smtp.example.com');    // The hostname of the mail server
        define('SMTP_FROM',   '[email protected]'); // SMTP From email address
        define('SMTP_NAME',   'e.g Website Name');    // SMTP From name
        define('SMTP_PORT',   '25');                  // SMTP port number - likely to be 25, 465 or 587
        define('SMTP_SECURE', 'tls');                 // Encryption system to use - ssl or tls
        define('SMTP_AUTH',    true);                 // Use SMTP authentication (true|false)
        define('SMTP_DEBUG',   0);                    // for debugging purposes only set to 1 or 2
  3. Add following code to functions.php of your theme or using Code Snippet plugin.
  4.     // SMTP Authentication
        add_action('phpmailer_init', 'send_smtp_email');
        function send_smtp_email($phpmailer) {
        	$phpmailer->isSMTP();
        	$phpmailer->Host       = SMTP_HOST;
        	$phpmailer->SMTPAuth   = SMTP_AUTH;
        	$phpmailer->Port       = SMTP_PORT;
        	$phpmailer->Username   = SMTP_USER;
        	$phpmailer->Password   = SMTP_PASS;
        	$phpmailer->SMTPSecure = SMTP_SECURE;
        	$phpmailer->From       = SMTP_FROM;
        	$phpmailer->FromName   = SMTP_NAME;
        }

Conclusion

We are now done with setting up the SMTP successfully to create an active communication channel between SMTP provider and all applications. By finishing this tutorial you have learned how to install and set up WordPress SMTP plugin. Now all WordPress emails are sent using SMTP protocol and there is less chance for emails to end up in the spam / junk folder.
Considering the ease of implementing SMTP in WordPress, there’s almost no reason why you shouldn’t do this today.