If you are facing any issues in sending an email in WordPress, then this guide is for you. Here, we discuss how to configure your WordPress so it can send emails properly.
Email configuration depends on your hosting provider. This guide covers two common hosting setups:
- Shared hosting with cPanel: GoDaddy, HostGator, Bluehost, etc.
- VPS hosting: DigitalOcean, Vultr, Hetzner, etc.
For each hosting setup, you’ll learn how to configure WordPress email using two SMTP plugins: WP Mail SMTP (Option 1) and SMTP by WordPress.org (Option 2). You can try either option, depending on which works best for your hosting environment.
- Option 1: Configure email using WP Mail SMTP plugin
- Option 2: Use the SMTP plugin from WordPress.org
Option 1: Configure email using WP Mail SMTP plugin
WP Mail SMTP is a popular WordPress plugin that lets you send emails through your hosting provider or an external email service.
Install and activate the WP Mail SMTP plugin from the WordPress plugin repository.
Once installed, go to the WP Mail SMTP > Settings > General in your WordPress admin. The configuration depends on your hosting environment.
Option 1 (A): Configure WP Mail SMTP on cPanel-based hosting
This applies to many shared hosting providers and managed WordPress hosting environments. If your website uses shared hosting with cPanel, try the following options.
Method 1: Use the Default mailer
First, try the default mailer provided by your hosting server.

- Go to WP Mail SMTP > Settings > General.
- Scroll down to the Mailer section and select Default (none).
- Click Save Settings.
- Go to WP Mail SMTP > Tools > Email Test and send a test email to check whether WordPress can send emails successfully.

If the test email arrives successfully, you don’t need to configure additional SMTP settings.
Method 2: Use your hosting provider’s SMTP settings
If the default mailer does not work, you can use your hosting provider’s SMTP settings.
- Log in to cPanel.
- Open Email Accounts.
- Select or create the email account you want to send from.
- Find the email configuration details, usually under Connect Devices or a similar option.
- Note the outgoing mail server, SMTP port, encryption, username, and password.
Now open WP Mail SMTP > Settings > General and select Other SMTP.
Enter the SMTP details provided by your hosting provider:
| Setting | Value |
|---|---|
| SMTP Host | Outgoing mail server (e.g., mail.yourdomain.com) |
| Encryption | None, SSL, or TLS (as specified by your hosting provider) |
| SMTP Port | 587 for TLS or 465 for SSL (depending on your host) |
| Auto TLS | ON |
| Authentication | ON |
| SMTP Username | Email address configured in your hosting account |
| SMTP Password | Password configured for that email account |
Note: These are common SMTP settings. Always use the port recommended by your hosting provider. Generally, port 587 is used with TLS, while port 465 is used with SSL/TLS. Port 25 and 2525 may also be supported depending on your hosting provider.
Save the settings and send a test email (WP Mail SMTP > Tools > Email Test).
Some shared hosting providers restrict outgoing connections to external SMTP servers. They may allow connections to their own mail server but block connections to third-party services. If you cannot connect to an external SMTP server, contact your hosting provider and ask whether the required SMTP port is blocked. If it is, request that they unblock it.
Method 3: Use a supported API integration
If your email service provider offers a dedicated integration in WP Mail SMTP, you can connect it through the provider’s API instead of configuring a direct SMTP connection.
This method uses an API key or other authorization credentials, rather than an SMTP username and password.
WP Mail SMTP supports dedicated integrations with several email delivery services, including Postmark, Mailgun, and SMTP2GO. The available integration options depend on the provider and the plugin’s supported mailers.
To configure an API integration:
- Create an account with your chosen email delivery service.
- Verify your sending domain and complete any required sender authentication.
- Obtain the API key or credentials required by the service.
- In your WordPress admin, open WP Mail SMTP > Settings > General.
- Under Mailer, select your email service provider (Postmark, Mailgun, SMTP2GO, etc.).
- Follow the on-screen instructions and enter the required API credentials.
- Save the settings.
Send a test email (WP Mail SMTP > Tools > Email Test) to verify that the integration works.
Note: API integrations communicate with the email service through its API rather than a direct SMTP connection. This means you don’t need to enter SMTP host, port, username, or password settings. Use the API credentials provided by your chosen service.
Option 1 (B): Configure WP Mail SMTP on a VPS
On a VPS such as DigitalOcean, Linode, Vultr, or similar providers, you can configure WordPress to send emails through an external SMTP service.
Step 1: Choose an SMTP provider
You can use an external email delivery service such as Postmark, Mailgun, or SMTP2GO. Depending on the provider and the connection method you choose, you can connect the service through a dedicated API integration or its SMTP server.
First, create an account with your chosen email service provider and verify your sending domain. Then decide how you want to connect it to WP Mail SMTP:
- API integration: Obtain the API key or other authorization credentials required by your provider.
- SMTP connection: Obtain the SMTP host, port, encryption type, username, and password from your provider.
Step 2: Configure WP Mail SMTP
WP Mail SMTP supports two main ways to connect your website to an external email service: a dedicated API integration or a direct SMTP connection. Follow the relevant instructions below, depending on the connection method you chose.
Use a supported API integration
If your email service provider offers a dedicated integration in WP Mail SMTP, select its mailer to connect through the provider’s API. This method uses an API key or other required authorization credentials. You do not need to enter SMTP host, port, username, or password settings manually.
- In your WordPress admin, open WP Mail SMTP > Settings > General.
- Under Mailer, select your email service provider (Postmark, Mailgun, SMTP2GO, etc.).
- Follow the on-screen instructions to connect your account, usually by entering an API key or other required credentials.
- Save the settings.
Send a test email (WP Mail SMTP > Tools > Email Test) to verify the configuration.
Use Other SMTP
If you want to connect through your email provider’s SMTP server, select Other SMTP. Use this option when you have SMTP connection details from your provider or prefer a direct SMTP connection instead of a dedicated API integration.
Enter the SMTP connection details provided by your email service, including the SMTP host, encryption type, port, username, and password.
For example, the following are typical settings for these providers. Confirm the exact settings and credentials in your provider’s documentation or dashboard.
Mailgun:
| Setting | Value |
|---|---|
| SMTP Host | smtp.mailgun.org |
| Encryption | TLS |
| SMTP Port | 587 |
| SMTP Username | Your Mailgun SMTP username |
| SMTP Password | Your Mailgun SMTP password |
SMTP2GO:
| Setting | Value |
|---|---|
| SMTP Host | mail.smtp2go.com |
| Encryption | TLS |
| SMTP Port | 587 |
| SMTP Username | Your SMTP2GO SMTP username |
| SMTP Password | Your SMTP2GO SMTP password |
These are example configurations. Use the region-specific host or alternative port if your provider recommends it.
Step 3: Test your email configuration
Save the settings and send a test email (WP Mail SMTP > Tools > Email Test) to verify the configuration.
Important: VPS providers may restrict outgoing SMTP ports such as 25, 465, or 587. If your SMTP connection times out, contact your VPS provider and ask whether the required SMTP port is blocked. Request that they unblock it if necessary.
Option 2: Use the SMTP plugin from WordPress.org
The WordPress.org Plugins Team provides a lightweight, community-maintained SMTP plugin that allows WordPress to send emails through an SMTP server of your choice.
It provides a simple configuration interface under Tools > SMTP, where you can enter your SMTP server details without needing a more feature-rich email delivery plugin.
Install and activate the SMTP plugin from WordPress.org.
Option 2 (A): Configure SMTP on cPanel-based hosting
If you are using shared hosting with cPanel, you can configure WordPress to send emails through your hosting provider’s SMTP server.
Step 1: Find your SMTP settings
- Log in to cPanel.
- Open Email Accounts.
- Select or create the email account you want to send from.
- Find its email configuration details, usually under Connect Devices.
- Note the outgoing mail server, SMTP port, encryption, username, and password.
Step 2: Configure the SMTP plugin
In your WordPress admin, open Tools > SMTP and enter the SMTP details provided by your hosting provider.

| Setting | Value |
|---|---|
| Provider | Generic SMTP |
| Host | Outgoing mail server (e.g., mail.yourdomain.com) |
| Port | 587 for TLS (STARTTLS) or 465 for SSL (depending on your host) |
| Encryption | TLS (STARTTLS), None, or SSL (as specified by your hosting provider) |
| Authentication | Enabled |
| Username | Email address configured in your hosting account |
| Password | Password configured for that email account |
| From email | Email address configured in your hosting account |
| From name | Your preferred sender name |
Note: These are common SMTP settings. Always use the port recommended by your hosting provider. Generally, port 587 is used with TLS (STARTTLS), while port 465 is used with SSL. Ports 25 and 2525 may also be supported depending on your hosting provider.
Step 3: Test your email configuration
Save your settings and open the plugin’s Test tab to send a test email.

Check whether the test email arrives successfully. If it fails, review the connection log and verify your SMTP hostname, port, encryption, and credentials.
Some cPanel and shared hosting providers restrict outgoing SMTP connections to external email services. They may allow connections to their own mail server but block connections to third-party services.
If you cannot connect to an external SMTP server, contact your hosting provider and ask whether outgoing SMTP connections are restricted. If the required SMTP port is blocked, request that they unblock it so your website can connect to the external email service.
Option 2 (B): Configure SMTP on a VPS
If your website is hosted on a VPS such as DigitalOcean, Vultr, Hetzner, or similar providers, you can configure this plugin to send emails through an external email delivery service.
Step 1: Choose an SMTP provider
You can use an external email delivery service such as Mailgun or SMTP2GO.
First, create an account with your chosen email service provider and verify your sending domain. Then obtain the SMTP credentials required by that provider.
Step 2: Configure the SMTP plugin
In your WordPress admin, open Tools > SMTP and enter the SMTP settings provided by your email service.
The following are example configurations for popular SMTP providers. Confirm the exact hostname and credentials in your provider’s documentation or dashboard.
Mailgun:
| Setting | Value |
|---|---|
| Host | smtp.mailgun.org (or your region-specific SMTP hostname) |
| Port | 587 |
| Encryption | TLS |
| Authentication | Enabled |
| Username | Your Mailgun SMTP username |
| Password | Your Mailgun SMTP password |
| From Email | Your verified sending email address |
| From Name | Your preferred sender name |
SMTP2GO:
| Setting | Value |
|---|---|
| Host | mail.smtp2go.com |
| Port | 587 |
| Encryption | TLS |
| Authentication | Enabled |
| Username | Your SMTP2GO SMTP username |
| Password | Your SMTP2GO SMTP password |
| From Email | Your verified sending email address |
| From Name | Your preferred sender name |
These are example configurations using port 587 with TLS. Use the exact SMTP hostname, port, encryption, and credentials recommended by your provider.
Step 3: Test your email configuration
Save the settings and open the plugin’s Test tab to send a test email.
Check whether the email arrives successfully. If the connection fails, review the connection log and verify your SMTP credentials and server settings.
VPS providers may restrict outgoing SMTP ports such as 25, 465, or 587 by default. If your SMTP connection times out or cannot connect, contact your VPS provider and ask whether the required outbound SMTP port is blocked. Request that they unblock it if necessary.
