You can easily send an email from WordPress using SMTP. You need to create an email account and use it in a WordPress plugin.
An SMTP plugin does not add any additional load to the website. It uses the PHPMailer.php script to send emails, which is already a part of WordPress core files. WordPress uses the same script by default to send emails using mail(). The plugin simply instructs WordPress to use SMTP instead of mail() when sending emails.
Using SMTP also has some advantages. The mail() function is one of the most common sources of spam. Mail servers around the world are increasingly marking emails sent using mail() as spam. Using SMTP helps you avoid that and improves email delivery.
Another advantage is that SMTP helps troubleshoot email issues from your website. SMTP plugins typically can log all commands and responses to the SMTP server. If you are having errors sending emails, these logs can help troubleshoot the issue.
There are many plugins that allow you to send emails using SMTP. You can use one that is popular and has good remarks from its users:
https://wordpress.org/plugins/search/SMTP/
Once the SMTP plugin is configured, all plugins and themes will automatically use SMTP to send emails. No other configuration is required.
Applies To:
This guide applies to Web Hosting, Semi Dedicated Hosting, and Reseller Hosting.
Step 01: Create an Email Address to Use in WordPress
- Go to cPanel > Email Accounts.
- Click "Create".
- Enter the Username and Password for the email account.
- Click "Create".
- Done!
Step 02: Install FluentSMTP Plugin
In this article, we are using the FluentSMTP plugin. You can use any plugin you like.
- Log in to WordPress Dashboard:
Go to cPanel > WordPress Manager by Softaculous > Login. - Go to WordPress Dashboard > Plugins > Add New.
- Enter "FluentSMTP" in the Keyword field to find the plugin.
- Click "Install Now" on the FluentSMTP plugin.
- Click "Activate".
Once activated, you need to configure the plugin.
Step 03: Configure FluentSMTP
- Go to WordPress Dashboard > Settings > FluentSMTP > Settings.
- If this is the first time you are configuring the plugin, you can enter details here. Otherwise, go to Active Email Connections > Edit.
- Configure the settings as mentioned below:
- Connection Provider/Email Service Provider: Other SMTP
- Sender Settings
From Email: <your email address, e.g.,you@yourdomain.com
>
From Name: <your name or website name>
Force From Email:Enabled
Set the return path to match the From Email:Enabled
Force Sender Name: Disabled - SMTP Host: <server hostname, e.g.,
server.providerdomain.com
(recommended) or yourdomain.com or mail.yourdomain.com>
SMTP Port:465
Encryption:SSL
Use Auto TLS: Enabled
Authentication:Enabled
Store Access Keys in DB: Enabled - SMTP Username: <your email address, e.g.,
you@yourdomain.com
>
SMTP Password: <your email password>
Note:
If you get any error using [yourdomain.com] or [mail.yourdomain.com] as the SMTP Host, try using [server.providerdomain.com].
Do not use the default email address of your hosting account as the SMTP Username. The default email address looks like username@server.providerdomain.com.
- Connection Provider/Email Service Provider: Other SMTP
- Click "Save Settings".
- Go to FluentSMTP > Settings > General Settings.
- Make sure the following values are correct:
- Default Connection: SMTP - you@yourdomain.com
- Deselect "Disable sending all emails".
Enabling this option will disable all emails.
- Default Connection: SMTP - you@yourdomain.com
- Click "Save Settings".
- Done!
Step 04: Send Test Email
- Go to WordPress Dashboard > Settings > FluentSMTP > Email Test.
- Click the field next to "From" and select an email address in the dropdown.
- Enter an email address next to "Send To". The email will be sent to this email address.
- Click "Send Test Email".
- The "Test email has been successfully sent" message will appear after it sends the email.
- If you get any error, refer to the Troubleshooting section below.
- Done!
You should now be able to send emails from WordPress. If you use a CDN or external email, please refer to the steps below.
CDN/Cloudflare/QUIC.cloud
If you use a CDN, Cloudflare, QUIC.cloud, or their nameservers:
- Use the server hostname, e.g.,
server.providerdomain.com
, as the SMTP Host. - Or, make sure the SMTP Host (yourdomain.com or mail.yourdomain.com) is not proxied by Cloudflare/QUIC.cloud/CDN.
If the SMTP Host is proxied, the plugin will not connect to the mail server and time out.
External SMTP
If you use an external email account that is not hosted on your hosting account, e.g., hosted email services like SendGrid, Mailchimp, Gmail, Yahoo, Hotmail, etc.:
- Create an email account on your hosted email to send emails from WordPress.
- Depending on your hosted email service, you might need to enable Multi-Factor Authentication.
- (Old servers only) Contact support to enable external SMTP for your hosting account. You do not need to contact support if you use an email account hosted on the same hosting account or if you are on a recently deployed server.
Multi-Factor Authentication (2 Factor Authentication)
If you use the following hosted email services to send email from WordPress and have enabled Multi-Factor Authentication (2 Factor Authentication) for your hosted email, you need to create an App Password in your hosted email account settings (not on MechanicWeb servers).
Once created, use the App Password as the SMTP Password in the plugin:
- Gmail/Google Workspace
https://support.google.com/accounts/answer/185833?hl=en
https://myaccount.google.com/apppasswords
If you cannot create an app password in Gmail:https://fluentsmtp.com/docs/connect-gmail-or-google-workspace-emails-with-fluentsmtp
- Office 365/Hotmail
https://account.live.com/security
https://support.microsoft.com/en-us/account-billing/how-to-use-two-step-verification-with-your-microsoft-account-c7910146-672f-01e9-50a0-93b4585e7eb4
- Yahoo Mail
https://login.yahoo.com/account/security#less-secure-apps
https://help.verizonsmallbusinessessentials.com/s/article/SLN29264
https://help.turbify.com/s/article/SLN29264
- AOL
https://login.aol.com/account/security?lang=en-US
- Zoho
https://accounts.zoho.com/home#security/app_password
Troubleshooting
In some cases, you might get the following error due to a conflict with another plugin or feature:
{
"code": 422,
"message": "SMTP Error: data not accepted.",
"errors": [ "SMTP Error: data not accepted." ]
}
Or,
{
"code": 422,
"message": "SMTP Error: data not accepted.",
"errors": null
}
It is a known FluentSMTP issue. To solve the issue:
- Go to WordPress Dashboard > Settings > FluentSMTP > Settings.
- Enable the following option in "General Settings" (right sidebar):
Enable Multi-Part Plain Text version of your HTML Emails:Enabled
- Send a test email.
- Done!
Getting Support
Contact FluentSMTP directly if you are having any issues:
https://wordpress.org/support/plugin/fluent-smtp/
https://fluentsmtp.com/contact-us/
https://wpmanageninja.com/support
More Information
Here are some helpful links:
https://fluentsmtp.com/docs/set-up-fluent-smtp-with-any-host-or-mailer/
https://wordpress.org/support/topic/smtp-not-working-for-last-few-days-error-422-data-not-accepted/
https://fluentsmtp.com/docs/fluent-smtp-settings/
https://fluentsmtp.com/docs/connect-gmail-or-google-workspace-emails-with-fluentsmtp/
https://fluentsmtp.com/docs/configure-fluentsmtp-with-microsoft-outlook-office/
https://fluentsmtp.com/docs/set-up-amazon-ses-in-fluent-smtp/
https://fluentsmtp.com/docs/configure-smtp2go-in-fluentsmtp-to-send-emails/