This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Join our live AMA on the Future of Page Builders with Brizy's CEO! Register Now →

How to Set Up & Configure WordPress SMTP Server to Send Emails

Updated on April 14, 2023

16 Min Read
wordpress smtp

If you’re running a WordPress website, you must be aware of the potential issues affecting your email delivery.

It’s essential to ensure that your emails are being delivered straight to your users’ inboxes. However, WordPress’s default email delivery system can sometimes fail, which could result in your emails being marked as spam or not delivered.

Don’t worry; there’s a solution, i.e., SMTP.

A Simple Mail Transfer Protocol or SMTP server helps ensure your emails get delivered as intended. And this blog will guide you through setting up and configuring an SMTP server for your WordPress website. We’ll cover everything from Mailgun, SendGrid, and Gmail SMTP servers on Cloudways to setting up SMTP via the WP Mail SMTP plugin.

We’ll also dive into why WordPress emails may get marked as spam, how to troubleshoot SMTP issues, and explore some alternatives to SMTP for email delivery in WordPress. So, let’s get started and make sure your emails are delivered straight to your users’ inboxes!

WordPress SMTP: An Overview

SMTP, or Simple Mail Transfer Protocol, is a widely recognized and trusted protocol for sending email messages between servers.

The process involves delivering an email to an SMTP server, which then relays the message to the intended recipient’s SMTP server. This intricate communication between SMTP servers ensures that the message reaches its intended destination securely and efficiently.

Why Use SMTP With WordPress?

By default, WordPress uses the PHP mail function to send emails. However, SMTP is a better alternative for the following reasons:

  • Deliverability: SMTP ensures reliable email delivery.
  • Authentication: SMTP authenticates email senders to prevent spam and spoofing.
  • Flexibility: SMTP offers greater flexibility than PHP mail. For instance, it helps you send email messages from a different domain than your website.

How does SMTP work?

Here’s how the SMTP protocol works:

  1. The user composes an email.
  2. The email client connects to the outgoing mail server using the SMTP protocol.
  3. The outgoing server checks email addresses for validity.
  4. The outgoing server sends emails to the recipient’s server using SMTP.
  5. The incoming server receives and stores email in the recipient’s mailbox.
  6. Recipient accesses email using client or webmail.

How to Set Up SMTP in WordPress on Cloudways (The Easier Method)

Users often have multiple websites on a single server and want to use the same WordPress SMTP service. In this case, the ideal solution is to set up SMTP on a server instead of on each WordPress site separately.

How to Set Up SMTP Service on Server

Here’s how you can set up an SMTP service using Cloudways:

  • Sign up for a Cloudways account.
  • Existing Cloudways customers can directly log in to their account.
  • Click Servers > SMTP.

SMTP Option in Cloudways Server

You can choose between two options:

  • Your Own SMTP: If you plan to use a third-party service like Gmail SMTP, Mailgun, SendGrid, etc.
  • Elastic Email: If you want to set up SMTP easily using a partner service.

If you choose Your Own SMTP, you will be asked for the username and password of your selected SMTP provider.

SMTP option list in Cloudways

How to Set Up & Configure Mailgun SMTP for WordPress on Cloudways

Mailgun is an email automation service that lets you send, receive, track, and store emails for newsletters and notifications. It’s considered one of the best WordPress SMTP providers and offers a free plan that lets you send 5,000 emails per month with a limit of 300 messages per day.

To get started, create an account, add your domain name from the dashboard, and start sending emails.

Note: You may need to add a credit card before adding a custom domain name.

  • Log in to your Mailgun account.
  • Select “Sending” from the left navigation bar, then click “Domains.”

Mailgun account Domains option

On this page, you can view all custom domains, including the Mailgun sandbox domain. Trial Mailgun accounts are limited to using the sandbox domain.

  • Choose the domain you want to use.

Choose Domain from Mailgun account

  • Select SMTP from the given choices.

Select SMTP form Mailgun account

  • Note down your SMTP credentials (username and password).

Mailgun SMTP Credentials

  • Log in to Cloudways, select your server, and go to “SMTP” from the left menu bar.
  • Choose “Your Own SMTP” and select Mailgun as your email gateway provider.
  • Enter your username and password and click “Save.”

Select Mailgun as SMTP on Cloudways Server

  • Verify your SMTP configuration by sending a test email to your own email address.
  • Click the “Send Test Email” option.

Test email send from Mailgun via Cloudways

  • Enter the sender and recipient email addresses, then click “Send Test Email.”

Sender and receiver emails for test email via Mailgun on cloudways

  • Once the test email is sent successfully, your Mailgun email service is ready to use for outgoing transactional emails.

Test SMTP Email sent notification on Cloudways

How to Set Up & Configure SendGrid SMTP for WordPress on Cloudways

SendGrid is a cloud-based SMTP service for bulk marketing campaigns and transactional emails. They have 58,000+ paying customers, sending 35B+ emails monthly. You can try their free Essentials plan with 40k emails for 30 days and 100 emails/day forever.

To get started, create an account with SendGrid and use the same email address for the From Email.

  • Log in to your SendGrid account and click on the API Keys option.

API Keys option in Sendgrid account

  • Click Create API Key.

Create API Key in sendgrid

  • Input a name and Full Access permission.

Full Access permission on Sendgrid account

  • Copy the API Key and save it.

Sendgrid SMTP API Key

  • Log in to your Cloudways platform and choose the target server.

Target server on Cloudways for configuring SMTP

  • Click on the SMTP option and select Your Own SMTP.

SMTP option - Your Own SMTP on Cloudways

  • Choose SendGrid as your email gateway provider.
  • Enter your username and SendGrid’s API Key.
  • Click Save.

SendGrid SMTP on Cloudways

Cloudways offers you the on-site functionality of testing your SMTP settings immediately after configuring the SMTP service on the server.

  • Verify your SendGrid SMTP configuration by sending a test email to your own email address.
  • Go to Server Management > SMTP.
  • Click Send Test Email.

Send test email for SendGrid SMTP

  • Enter the sender and recipient email addresses.
  • Click Send Test Email and wait for the notification of a successful test email.

Sender and receiver emails for test email via Mailgun on cloudways

Test SMTP Email sent notification on Cloudways

How to Set Up & Configure Gmail SMTP for WordPress On Cloudways

Here’s how you can set up Gmail SMTP on Cloudways.

Prerequisites

You must consider these precautions before setting up Gmail SMTP:

  • If you have enabled Two-Factor Authentication on your Gmail account, generate a special password and note it down.
  • If you have not enabled Two-Factor Authentication, allow access to less secure apps from here by clicking the Turn On button.
  • Authorize your server to access your Gmail account. If you have merged multiple accounts on Gmail, log in with the main account, open this link, and click Continue.

Let’s set up Gmail SMTP on the server.

  • On the Cloudways platform, select the Other option to set up Gmail SMTP on the server.
  • Enter the host, port, username, and password.
    • Host: smtp.gmail.com
    • Port: 587
    • Username: Your Gmail Email Address
    • Password: Your Gmail Password (or App Generated Password)

Gmail SMTP configuration on Cloudways server

In fact, by following the above steps, you can configure any third-party SMTP service provider that is not on the list.

Heads Up!

By setting up SMTP on a server, all applications will use these WordPress SMTP settings. Make sure to change the From Address on each application.

 

  • Go to Application Management > Application Settings.
  • Configure the Default Email Sender in your application settings.

Configure the Default Email Sender in your application settings on Cloudways

  • Repeat the same steps for multiple servers.

How to Set Up SMTP in WordPress via WP Mail SMTP Plugin

You can set up SMTP on a server or via a WordPress plugin. To select a plugin, check out our guides on Post SMTP and WP Mail SMTP by WPForms.

Here’s how you can set up SMTP on your WordPress website using WP Mail SMTP plugin:

  • Install and activate the WP Mail SMTP plugin on your WordPress website.

WP Mail SMTP Plugin installation and activation

  • You will see the new WP Mail SMTP label.

WP Mail SMTP on WP Admin menu bar

  • Change the default email address to your desired email address and name by checking the Force From Email and Force From Name checkboxes.

Force From Email and Force From Name in Wp Mail SMTP plugin

Next, you have to set up an SMTP service provider. In this example, I will cover the setup process of the following SMTPs:

Don’t see your SMTP provider in the list? Don’t worry; the steps for setting up an SMTP provider are generally similar.

How to Set Up & Configure Mailgun SMTP for WordPress

Follow the steps below to configure Mailgun SMTP on your WordPress website:

  • Go to your Mailgun account and add a new domain by clicking on Sending > Domain.

Mailgun account Domains option

  • Click the Add New Domain button.

Add new Domain on Mailgun account

  • Enter the subdomain and select the Domain region.

Adding Domain name and Domain Region on Mailgun

  • Click Advanced settings (DKIM) and select 2048 to add an extra security layer.
  • Click Add Domain.

DKIM Key Length on Mailgun

  • Once you add the subdomain, you’ll be redirected to the next screen where you’ll see the DNS essentials.

DNS essentials on Mailgun

  • Verify the domain by adding two TXT records and two MX records to your site’s DNS settings.
  • Click on Add New Record.

Advance DNS settigns on your doamin registrar panel

  • Copy/paste all the TXT record details from your Mailgun account into your site’s DNS.

TXT Records

  • Now add the MX records.

MX Records

  • After adding the TXT and MX records, click “Verify DNS settings” for Mailgun to confirm proper DNS records.

Verify DNS Settings

  • Verification may take up to 48 hours. After verification, your domain will display an “active” status.
  • To link the API with WP Mail SMTP plugin, select Mailgun under the mailer section in WP Mail SMTP.

Select MailGun from WP Mail SMTP plugin under Mailer section

  • Enter Private API Key and Domain Name, and select Region.
    To obtain the API key, go to Mailgun account and select API Keys from the top-right dropdown.

Mailgun account and select API Keys

  • Copy the Private API key.

Private API key

  • Paste Private API Key, and enter Domain Name, and select Region.

Paste Private API Key, Domain Name, and Region in WP Mail SMTP for Mailgun

  • Click Save Settings.

Save Settings of WP Mail SMTP

  • Verify domain, add settings to WP Mail SMTP, and send a test email.
  • Go to WP Mail SMTP > Tools > Email Test, enter email address, and click Send Email.

Test Email Send via WP Mail SMTP plugin

  • Check your inbox for the test email.

Test Email successfully sent

And that’s it!

How to Set Up & Configure SendGrid SMTP for WordPress

Configure SendGrid SMTP for your WordPress website using these steps:

  • Use the API key you saved earlier from configuring SendGrid on Cloudways in the WP Mail SMTP plugin.

Sendgrid SMTP API Key

  • Navigate to WP Mail SMTP > Settings and select SendGrid as your mailer.

Sengrid option on WP Mail SMTP plugin under Mailer section

  • Enter your API key and save the settings.

Sendgrid API Key

  • Go to the Email Test tab, enter the recipient email address, and send a test email to confirm everything is working.

Test Email Send via WP Mail SMTP plugin

How to Set Up & Configure Gmail SMTP for WordPress

Unlike Mailgun and SendGrid, to set up Gmail SMTP using WP Mail SMTP, you need to get a Client ID and Client Secret.

Read these precautions carefully.

  • For two-factor authentication enabled Gmail accounts, generate and note down a special password using “Sign in using App Passwords.”
  • For accounts without two-factor authentication, toggle the “Turn On” button to allow access to less secure apps.
  • Log in with the main Gmail account that has all other accounts merged, allow access, and click “Continue” to authorize server access to your Google account.

Follow the steps below:

  • Go to WP Mail SMTP > Settings and select Google/Gmail as your mailer.

Gmail SMTP option in WP Mail SMTP plugin under Mailer section

  • Enter your Client Secret, Client ID, and Authorized Redirect URL.
  • Pause setup and create a new Google Cloud app first.
  • Open the Google Cloud Console dashboard and create an API connection. This will prevent the need to disclose login details.
  • Login to your Google account if needed and accept the Terms of Service if it’s your first time using Google Cloud.

Google Cloud Console dashboard

  • Click Create Project to to set up a new project

Create Project

  • Enter a project name, then click Create.

WordPress SMTP Project created on Google Cloud console

  • Enable Gmail API by going to APIs & Services > Library and searching for “Gmail API”.

Select the Gmail API

  • Click Enable.

Enable the Gmail API

  • Follow the instructions to create credentials.

create credentials for Gmail SMTP

  • On the Overview page, click on Create Credentials and select Gmail API.
  • Select User data and click Next.

Select API and User Data

  • Set up your App Information by entering an app name, selecting your email address from the dropdown menu.

Application information

  • Enter your email address in the Developer contact information section & click the Save and Continue button.

Developer contact information

  • Skip the Scopes section and click the Save and Continue button again to set up the Client ID.
  • In the OAuth Client ID dropdown, select Web application.

OAuth Client ID dropdown, select Web application.

  • Click Add URI in the Authorized redirect URIs section and paste in https://connect.wpmailsmtp.com/google/ from the WP Mail SMTP Setup Wizard.
  • Click on the Create button.

Authorized redirect URIs

  • Copy the Client ID.

Copy the credentails

  • Switch over to the browser tab where you were using your WordPress website, and paste the Client ID.

Client ID in WP Mail SMTP plugin for gmail

  • Find the credentials you just created under OAuth 2.0 Client IDs.
  • Click the pencil icon on that line to get the Client Secret.

OAuth 2.0 Client IDs and copy the Client Secret

  • Copy your Client Secret.

Copy your Client Secret

  • Go to your WordPress website and paste the Client Secret.

WordPress website and paste the Client Secret

  • Click Save Settings.

If you’re using a Gmail account for free, your app will be put in Testing mode by Google. It’s crucial to modify this option.

  • Transition from Testing mode to Production mode:
  • Go to Cloud Console.
  • Select APIs & Services > OAuth Consent Screen.
  • Under Publishing Status, click Publish App.

Publish the App under API and Services

  • Click Confirm.

Push to production

And that’s it! Your app is now live in Google Cloud Console.

  • Open the WP Mail SMTP tab in your browser.
  • Scroll down to the “Allow plugin to send emails using your Google account” button under Authorization and click on it.

Allow plugin to send emails using your Google account

  • Log in to your Google account on the page that appears, and select “Allow” to give authorization to your website to send emails.

Allow to give authorization to your website to send emails

  • Click “Advanced” and then “Go to wpmailsmtp.com (unsafe)”.

Go to wpmailsmtp.com (unsafe)

  • Click “Continue” to allow access.

Click Continue to allow access

  • You will be redirected to your WordPress website, where you should see the WP Mail SMTP prompt confirming successful linking of your site with your Google API project.

successful linking of your site with your Google API project

  • To test the configuration, go to WP Mail SMTP > Tools > Email Test.
    Enter the recipient email address, and click “Send Email”.

Test Email Send via WP Mail SMTP plugin

  • Check your Gmail inbox to see the test email.

Test Email successfully sent

If you encounter limitations with the free version of Gmail, consider using a premium SMTP provider, and configure the settings accordingly.

SMTP Commands

SMTP uses a number of commands to transfer email messages between mail servers. These commands include:

  • HELO: This command is used to initiate a connection between two SMTP servers.
  • MAIL FROM: This command is used to specify the sender’s email address.
  • RCPT TO: This command is used to specify the recipient’s email address.
  • DATA: This command is used to indicate the start of the email message.
  • QUIT: This command is used to terminate the SMTP session.

SMTP also uses a number of response codes to indicate the success or failure of a command. These response codes include:

  • 220: The server is ready.
  • 250: The command was successful.
  • 354: The server is ready to receive the email message.
  • 450: The requested action was not taken due to a temporary error.
  • 550: The requested action was not taken because the recipient’s mailbox is unavailable or the email address is invalid.

Overall, SMTP plays a crucial role in the delivery of email messages over the internet. By using a standardized protocol, you can reliably deliver emails between mail servers and recipients can access their messages from anywhere in the world.

How to Troubleshoot SMTP issues in WordPress

When setting up and configuring your WordPress SMTP server to send emails, you may run into some issues. In this section, we’ll discuss the most common problems and provide step-by-step solutions to help you troubleshoot and resolve these SMTP issues in WordPress.

Check Your SMTP Settings

The first step in troubleshooting SMTP issues is to ensure that your SMTP settings are configured correctly. Double-check the following:

  • Host: Confirm that you have entered the correct SMTP server hostname.
  • Port: Verify that you’re using the right port number (typically 465 for SSL or 587 for TLS).
  • Encryption: Make sure you’ve selected the correct encryption method (SSL or TLS) for your SMTP server.
  • Username and Password: Ensure that you’ve entered the correct login credentials for your SMTP server.

Verify Your Email Address

Some SMTP servers require that the ‘From’ email address be a valid account on the server. Double-check that the email address you’re using is correct and that it’s a valid account.

Examine Your WordPress Logs

If you’re still encountering issues, check your WordPress logs for any error messages. Enable WordPress debug mode by adding the following lines to your wp-config.php file:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Once you’ve enabled debug mode, try sending an email again. Afterward, check the debug.log file located in the wp-content directory for any error messages related to your SMTP server.

Check for Plugin Conflicts

Plugin conflicts can cause SMTP issues in WordPress. To rule out this possibility, deactivate all plugins except the SMTP plugin you use. If the issue is resolved, reactivate each plugin one by one until the problem reoccurs. This will help you identify the conflicting plugin.

Contact Your Hosting Provider

Some web hosts may block certain ports or have strict security measures in place, which can cause SMTP issues. Contact your WordPress hosting provider to confirm that they allow connections to your SMTP server and to ensure that no restrictions or firewalls are causing the problem.

Test Your SMTP Server

To determine if the issue lies with your SMTP server, use an SMTP testing tool, such as SMTP Prober or MX Toolbox, to test the server’s connectivity and authentication. If you’re unable to connect or authenticate, contact your email service provider for assistance.

Try an Alternative SMTP Plugin

If you’re still experiencing issues, consider trying an alternative WordPress SMTP plugin, such as WP Mail SMTP, Post SMTP, or Easy WP SMTP. Each plugin has its unique features and configuration options, which may work better with your specific server settings.

By following these troubleshooting steps, you should be able to identify and resolve any SMTP issues in your WordPress site, ensuring smooth and reliable email delivery.

Final Thoughts

In short, setting up your WordPress SMTP server is a must for top-notch email deliverability! Whether you choose Cloudways or the WP Mail SMTP plugin, both can seriously level up your email game.

We’ve got you covered with simple steps to configure popular SMTP services like Mailgun, SendGrid, and Gmail, giving you plenty of options. Remember, a reliable email setup is crucial for earning trust and credibility with your audience.

So, follow our handy guidelines to keep your emails flowing smoothly and your website performing at its best. Get that SMTP setup done right, and watch your email performance soar! Happy emailing! 🚀📧

Frequently Asked Questions

Q: What is the SMTP server for WordPress?

There isn’t a specific SMTP server for WordPress. SMTP (Simple Mail Transfer Protocol) is a standard protocol for sending emails, and you can use various SMTP services like Mailgun, SendGrid, or Gmail to configure and send emails from your WordPress website.

Q: How do I set up SMTP for WordPress?

You can set up SMTP for WordPress through a hosting platform like Cloudways or the WP Mail SMTP plugin. Each method requires configuring an SMTP service like Mailgun, SendGrid, or Gmail. Follow the step-by-step instructions provided in their respective sections in the blog.

Q: Why do WordPress emails get marked as spam?

WordPress emails may get marked as spam due to a lack of proper authentication, shared IP addresses, or poorly configured email headers. Configuring an SMTP server helps improve email deliverability and reduces the chances of emails landing in spam folders.

Q: Do I need an SMTP server to send WordPress emails?

While it’s possible to send WordPress emails without an SMTP server, using one significantly improves email deliverability, ensuring your emails reach the intended recipients. SMTP servers provide better authentication and infrastructure for sending emails.

Q: How can I optimize SMTP performance in WordPress?

To optimize SMTP performance in WordPress, follow these steps:

  • Choose a reliable SMTP service provider like Mailgun, SendGrid, or Gmail.
  • Configure the SMTP server correctly using the hosting platform or a plugin.
  • Verify your domain and use proper authentication mechanisms (SPF, DKIM, and DMARC records).
  • Test your email deliverability and monitor your email reputation.
  • Use a dedicated IP address, if available, to avoid shared IP issues.

Q: Are there any security considerations when using SMTP in WordPress?

Yes, consider the following security aspects when using SMTP in WordPress:

  • Use strong authentication credentials and keep them secure.
  • Use SSL/TLS encryption to secure email communication between your website and the SMTP server.
  • Keep your WordPress installation and plugins up-to-date to prevent security vulnerabilities.
  • Regularly monitor your email reputation and take corrective action if necessary.
Share your opinion in the comment section. COMMENT NOW

Share This Article

Danish Naseer

Danish Naseer is a WordPress Community Manager at Cloudways. He is passionate about designing, developing, and engaging with people to help them. He also actively participates in the community to share his knowledge. Besides that, he loves to watch documentaries, traveling and spending time with family. You can contact him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now