This KB explains how to configure SMTP service for transactional (outgoing) emails on a WordPress application. We will also show you the simple process of setting the email headers (From Name and Sender Email etc.) through this plugin.
How to Install and Configure WP Mail SMTP Plugin to Send Emails
Step 1: Install and Activate WP Mail SMTP Plugin
The first step of the process is the installation of the WP Mail SMTP plugin. For this log into the WordPress admin area of your site using the admin credentials.
In the left admin menu, click on Plugins, and then on Add New.
Locate the SMTP plugin via the search bar (WP Mail SMTP by WPForms for the purpose of this KB). Next, click the Install Now button.
Once the installation finishes, click the Activate button.
Step 2: Configure Sender Name and Email Address
To start the configuration process, visit the Plugins section in the left admin menu and locate the SMTP plugin. Click Settings to start the configuration process.
You will see the following screen with three major options.
In this field, enter the email address that you wish to set as the From email. This is the email address that will appear on all outgoing emails. Depending upon your requirements and the target audience, this email could be email@example.com or firstname.lastname@example.org.
It is also recommended to check the Force From Email checkbox to override any other SMTP configurations.
In the From Name field, enter the name you wish to appear on your outgoing emails. A recommended practice is to check the Force From Name checkbox to override previous website settings.
Step 3: Configure SMTP Service
Select any of the below two methods.
PHP Settings (Default)
If you have configured server-wide SMTP on your server where your application is hosted, you can simply select PHP as a Mailer.
Other SMTP Settings (Optional)
If you haven’t configured server-wide SMTP or you want to use a different email service for your application, you can select any reliable service (such as MailGun, SendGrid, etc.) or choose Other SMTP.
In this KB, we are using MailGun as an example. If you are using any other SMTP, contact your email service provider for the recommended settings.
You can find your API Key from your Mailgun’s Control Panel as stated in their support KB.
Copy the key and then return to the WP Mail SMTP settings and paste it under the Private API Key field and then enter your Domain Name. Once these settings are saved, you’ll be ready to try sending a test email.
We also recommend checking the optional Return Path checkbox to Set the return-path to match the From Email. With this enabled, you will receive an email in the case where any messages bounce (mainly due to any issues with the recipient’s email service).
Step 4: Verify SMTP Settings
Now that the SMTP settings have been added to the WP Mail SMTP plugin, it is important to send a test email to ensure that everything is working properly. To do this, click the Email Test at the top of the plugin screen.
In the Send To field, enter a valid email address (that you can access), and click the Send Email button. If everything goes well, you will see a success message. Check the inbox to confirm that you have received the test email.
That’s it! You’ve successfully configured SMTP for your WordPress site. You’ll now start getting notifications from your WordPress forms.
Step 5: Add an SPF Record at Domain Registrar (Recommended)
To avoid any issues with the outgoing emails, we highly recommend adding an SPF record about your preferred email service provider at your Domain Registrar.
For this, log into your Domain Registrar. Navigate to Domain Management and then add a new record with the following values:
Host: Enter your server public IP address
TEXT Value: Add the SPF record as per your SMTP service provider’s recommendation.
TTL: Choose the lowest value
Click Save to apply the settings.
That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.