WordPress has a built-in ability to send email using the PHP function. This system doesn’t use traditional servers while sending messages as the process is governed over PHP coding within the website itself. Unfortunately, a lot can go wrong when sending mail this way.
For example, PHP messages don’t work well when trying to increase the email response rate. This is because of the function’s limited capabilities.
There are a lot of times when messages from the website are important. Perhaps one of the biggest examples is when a site uses visitor subscriptions to send newsletters or updates when new content is posted. Perhaps you want to send authors a message when their posts are published.
In this tutorial, we’ll show you how to fix sending WordPress email when it’s not working as you want it to. Because email can easily be added to your marketing tools as well as sharing information, it’s in your best interest to have a stable system.
Using PHP to Send WordPress Email
By default, there is very little that is available when configuring WordPress to use PHP email. Luckily, you can still change the PHP settings and add more customization to the process by using the Custom Email Options plugin.
This plugin can solve a lot of issues when it comes to the PHP message process such as changing the «from» address and name. To use this plugin to configure your email:
Go to «Plugins» from the WordPress admin panel.
Add a new plugin and search for «Custom Email Options.»
Install and activate the plugin. This will add a new function to the left admin panel labeled, «Email Options.»
Click the Email Options tool to access its settings.
In the first tab, you have access to the default settings of how your website sends messages. From here, you can choose to use SMTP instead of PHP. For now, leave this option as, «No.»
Change from email address: The plugin shows the default email address of your site. It should start with «wordpress» and then the domain. In the text field, enter the address you want to use instead. For instance, you would enter:
Change from email name: By default, your website sends messages in the name of «WordPress.» You can change this by entering the name you wish to be displayed, such as your own or an alias.
The rest of the settings should remain at their defaults for now until you want to customize messages further. Click the «Submit» button on the bottom left.
Click the «Extra Settings» tab.
On this page, you can choose to have a return-path which allows visitors to respond. You can also use a confirmation message when the message has been read. These are both optional functions, but may be helpful if you want to track or have direct communication with recipients. Otherwise, you can leave them blank.
Now, the PHP function will use the new settings to send messages. If you want to test it out for yourself, Custom Email Options comes with a «Test Email» tab in its settings. This demonstrates precisely how messages will appear through the PHP function.
Using SMTP to Send Messages
There are many reasons why people are using the PHP mail function less often. Many companies find the messages are getting trapped in spam filters while some web hosting providers are removing the feature entirely for security reasons. In either case, a lot of developers find that SMTP is a much more stable way to process mail.
Installing SMTP in WordPress forces the system to use the server to send messages rather than the website. This could cut down on traffic congestion of the site should there be a lot of visitors with messages being sent out. Of course, this is only a real problem if the site is exceptionally busy.
To use SMTP, we’re going to keep using the Custom Email Options plugin. It has basic control of the protocol, which is all we need to send email.
For this tutorial, we’re going to create an address specifically for the website through cPanel. This will give us all the information we need to fill in the plugin.
To use this plugin for SMTP:
Follow the directions above to install the Custom Email Options plugin.
Log into your cPanel account.
Click the link for «Email Accounts.»
In the «Add Email Account» screen, add a new address. For this tutorial, we’re naming it:
Using the drop-down window, select the domain of your website.
Enter a password for the email address.
Adjust the mail quota if the option is available. We’re leaving this one as the default because it’s unlikely mail will be sent to the address.
Click the button to «Create Account.»
When you scroll down, you’ll see a list of email addresses available in your hosting account. Search for the one you just created and click the link next to it for, «Set Up Mail Client.»
In the manual settings of the address, you’ll find all the info you’ll need for the plugin. Go back to your WordPress admin panel and click the «Email Options» function.
Change the «Send Email using SMTP» option to «Yes» and click the «Submit» button on the bottom.
Click the «Smtp Settings» tab.
Fill in the information from cPanel in this area.
NOTE: Many hosting providers will not be able to use SSL or TSL if there is not a secure socket layer installed on the site.
Click the button on the bottom to submit your changes.
Click on the «Test Email» tab and send a message to yourself. If the settings are incorrect, you’ll receive an error message, «SMTP connect() failed.» At which point, you need to verify your settings. Otherwise, your site will now use SMTP to send messages.
Although this plugin is riddled with grammatical errors, it works exceptionally well and is a quick and easy way to fix mail problems on your website.
Other Plugins of Note
There are some plugins to choose from when selecting a way to send email from the website. Some offer a variety of features while others are simple and basic. Here are a few that you may find interesting.
The Gmail SMTP plugin is popular among those who want to use their Google accounts to send messages. This platform uses OAuth 2.0 which makes it secure. This plugin connects to the account without enabling, «Allow less secure apps» in Google.
For those looking for integration, SMTP Mailer has several options that may pique your interest. It has been found to work with Jetpack, Visual Form Builder, Contact Form 7 and various other plugins. It’s also one of the highest rated mail plugins for WordPress.
WP Mail SMTP
Another basic SMTP mailing plugin is that of WP Mail SMTP. With more than half a million active installs, it’s one of the more popular mailing formats available for WordPress. Along with the settings for adding any email address to the system, it comes with a testing area for messages.
From personal spam filters to web host restrictions, PHP mail functionality is becoming more difficult. While most restrictions are put into place for security purposes, it still means you need to find a viable option for sending messages. Consider using SMTP instead of PHP to solve a large portion of these problems.
What kind of mailing additions do you use on your site? Does your website handle sending newsletters through PHP, or do you have a specific email account?