Are you having trouble receiving or sending emails from your WordPress site? One solution for that is to use third party email services such as Mailgun. However, these services will cost you extra money. In this article, we will show you how to use a SMTP server to send WordPress emails.
The Problem with WordPress Emails
WordPress uses mail function in PHP to send emails. Many shared hosting providers do not have this function configured properly, or they have disabled it entirely to avoid abuse. In either case, this causes your WordPress emails to not be delivered.
The alternative solution is to use a third party email service to send out your emails. You can use services like Mailgun, Google Apps for work, or Sendgrid.
You will have to pay for your account, and the cost will vary depending on how many users/accounts you add or the number of emails you send. See our tutorial on how to fix WordPress not sending email issue.
What if we told you that there is another option, and most likely you are already paying for it?
Video Tutorial
If you don’t like the video or need more instructions, then continue reading.
Using Email Accounts by Your Host
Most WordPress hosting providers offer email services for each domain you host with them. This means you can create email accounts with your own domain name like [email protected]
.
First you will need to create an email account. For the sake of this example, we will show you how to create an email account in cPanel. Your hosting service provider may use some other account management system, but the basic process is the same on most hosting services.
Log into your hosting account, and click on email accounts under the mail section.
This will show you a simple form where you need to fill out information required to create your email account.
Since we will be using this account to send WordPress emails, we recommend that you create an email account like [email protected]. Make sure to replace example.com with your own domain name.
After creating your email account, you are now ready to use it in WordPress. But before you do that, you will need the following information from your hosting service provider.
- SMTP Host for your email address.
- SMTP Port for secure login.
You can check the support section on your host’s website for this information. Most likely there will be an article providing this information. If you don’t find it, then you should contact the hosting support to request this information.
Using Your Branded Email Address in WordPress
You will now need to install and activate the WP Mail SMTP plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, you need to visit Settings » Email to configure the plugin settings.
First you need to enter the email address you just created. After that you can add a from name, this will be used as the sender name.
If you do not add a from name, then the plugin will use the default WordPress.
Next, you need to choose the mailer. Go ahead and click on the ‘Other SMTP’ option to select it.
After that, you need to check the box next to ‘Return Path’ option. This option sets the return path to match the sender email address. If you leave it unchecked, bounced messages and non-delivery receipts will be lost.
Next, you need to set up SMTP options.
First you need to enter your SMTP host and port. You can obtain this information from your hosting provider. Typically, SMTP host is mail.yourdomain.com (replace yourdomain.com with your own domain name). For SMTP Port 465 is commonly used.
Next, you need to choose encryption. Most WordPress hosting companies support SSL and TLS. We recommend using TLS option when available.
After that turn on the authentication toggle and provide your SMTP username and password. Normally, your email address is also your SMTP username.
Your password is stored as plain text, which is not safe. Don’t worry, we will show you how to make more secure later in this article.
Don’t forget to click on the save settings button to store your changes.
Testing Your SMTP Settings
Now that you have set up WP Mail SMTP to send emails, let’s test if everything is working fine. On the plugin’s settings page, click on the ‘Email Test’ tab.
You need to provide an email address where you would like to receive test email. This could be any valid email address that you can access. After that click on the Send Email button to continue.
WP Mail SMTP will now send an email message using the SMTP settings you entered earlier. You will see a success message when email is sent successfully.
Securing Your Email Password
You may need to enter your email account password in WP MAIL SMTP settings. This password is normally stored as plain text which is unsafe.
However, the plugin also provides you an option to make it more secure. To do that, you will need to add some code to your wp-config.php file. If you haven’t done this before, then please see our guide on how to edit wp-config.php file in WordPress.
First you will need to connect to your website using a FTP client or File Manager app in cPanel. Once connected, you will find your wp-config.php file in the root folder of your website.
You can edit this file using any plain text editor like Notepad or TextEdit.
Locate the line that says ‘That’s all, stop editing! Happy blogging’ and add the following code just before it.
define( 'WPMS_ON', true ); define( 'WPMS_SMTP_PASS', 'your_password' );
Don’t forget to replace ‘your_password’ with your actual SMTP password. After that, save and upload your wp-config.php file back to server.
You can now visit your WordPress admin area and go to Settings » WP Mail SMTP page. Scroll down to the SMTP options section and you will see password field is now disabled.
Troubleshooting WordPress Email Issues
The most common reason for errors in sending emails using SMTP is incorrect SMTP host or port. Make sure that you are entering the correct host and port settings provided by your hosting provider.
Make sure that you select the correct encryption method. Usually SSL works on most environments, but we recommend that you check with your web host if your emails are not getting delivered.
Pros and Cons of Using Your Web Host’s Mail Servers for WordPress Emails
First and the most obvious advantage is that you can use your own branded email address for outgoing emails in WordPress.
Another advantage is that you have already paid for this service when signing up for your hosting account. You will not need to pay any extra money for sending and recieving emails.
However, some WordPress hosting providers enforce limitations on outgoing emails. This is why we don’t recommend using WordPress to send newsletter emails.
Another common problem with shared hosting providers is that their mail servers can be quite unreliable at times. If you notice delays in email delivery, then you should consider using third party email services like Google Apps for Work, Mailgun, or SendGrid.
We hope this article helped you learn how to use SMTP server to send WordPress emails. You may also want to see our list of the must have WordPress plugins for businesses.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
MH says
If there have any option to configure multiple email as SMTP ?
I have two contact form and need to email sent from different email address.
WPBeginner Support says
You would want to check with the support for your contact form to see what is available.
Admin
Alexandru-Eugen Toma says
Thank you very much for much!
WPBeginner Support says
Glad our guide was helpful
Admin
khatamband says
I used today WP Mail SMTP
I used google apps for smtp authentication and testing it with test
but if I fill website fom, no mail is received
I also tried hosting email address for smtp authentaction. This was also successful in sending test mail, but for form mail — no mail received, although giving success output.
I also checked spam folder for both, nothing there too.
So where can be the issue
Sean says
Hi when i passed the code into the wp-config file my site stopped working, then i removed it and it still not going up.
Please help!!
WPBeginner Support says
Hi Sean,
Are you seeing an error or just white screen? Here is how you can replace your existing wp-config.php file with a fresh copy.
First, you need to connect to your website using an FTP client and download a copy of your wp-config.php file to your computer as a backup.
Next, you need to visit download a copy of WordPress from WordPress.org. You will need to unzip it, and inside you will find a file called wp-config-sample.php. Rename this file to wp-config.php.
Now open the wp-config.php file you saved earlier as the backup. It contains your WordPress database information. Like database name, password, host, table prefix, etc.
Copy the information from your backup to the new wp-config.php file and then upload the new file back to your server using the FTP client.
Admin
Sean says
Hi I just found the problem. There was missing space in the first line.
It’s strange cause I never edited it.. but everything is fine now. Thanks for quick response.
Abby says
Hi:
we are setting up a WordPress multi-site server. Our concern is if we use WordPress SMTP email how do we lock it down to ensure that it is not turned into an email spam bot? We occasionally experience DDOS attacks that are obviously looking for and scanning our existing business network for vulnerabilities and we do not want to give them a point of entry through the new WordPress multi site server. At present we use a self hosted exchange server for email and we have port 25, 465 and 587 locked down.
Thanks
Abby
Luke Cavanagh says
Transactional email providers like SendGrid or SparkPost are very reliable for site email.
Beata Raju says
Hi,
Thank you for the article, it’s really helpful. I’ve have a WordPress site hosted by HostGator with a shared server subscription. Do you know whether their email service is reliable or not? I’ve somehow managed to hook up my @mysite email address to outlook.com webmail but it does take forever for emails to come through. Do you think I should try another solution?
Many thanks in advance,
Beata
WPBeginner Support says
Hi Beata Raju,
Your hosting provider’s email service is not a reliable solution. You can look into email service provides like G Suite by Google.
Admin
Michael says
Sadly this option is not available in cases where GoDaddy is the host, as the blocks all outbound SMTP to ports 25, 465 and 587 to all servers except their own.
Trying Amazon SES per helpful comments above.
Anssi says
Hi!
Any tips how to speed up the sending process when using SMTP? CF7 form takes up to 10 seconds when using SMTP and 1-4 senconds while using PHP Mailer.
Wendy says
Hi, i am new to wordpress.
I am trying to configure email address using own company email.
It was tested successfully while setup.
But it prompt error when trying to submit request during the website.
FATOYINBO says
God bless you, it works like magic
Marcelo Luz says
Works fine with WP 4.9.3.1 Thank you for the tip!
Will says
Yes! This is the way to do it. In my case I use hostgator so it’s mail.mydomain.com and port 25 (standard email port). I was trying to use gmail and it didn’t work. I’m not sure why my site stopped working for the built in php mail even though it works on other domains on the same account.
Lynn Dye says
This is very timely. I’ve been struggling with this on behalf of a client. When I talked them into using the built-in email of their host along with setting up domain-branded email, it took care of most problems.
The other problem we’ve been having is getting notification emails to go to a yahoo email address. These have failed with an error message ‘not able to reach the server’, or perhaps a time-out of the server. I had that recipient get a gmail address for notifications to go to, but we’ve not seen the results yet.
Just an PSA to folks – when I was digging into why folks with the yahoo and aol emails were not getting their notifications, the Gravity Forms folks had in their forum an article on why notifications may not be going out. Seems AOL & Yahoo have very stringent rules on accepting emails from something that looks spammy (the acronym was DMARC), I believe. So when I got one business to get rid of AOL, their problems cleared up. The other business uses Yahoo for their business email (yes, people still do it). They were not getting notified regularly and that’s why I asked them to set up a gmail.
I will also be using some of the suggestions in this article to hopefully permanently fix this problem.
Alain Aubry says
If you use Mandrill you may use wpmandrill
Firdaus Azizi says
Used to be using WP Mail SMTP with Gmail. But since it’s not supporting oAuth, I’m now using Postman SMTP.
I find Postman SMTP is more user friendly + it has a log file for us to check all the emails that are being sent.
sazia kazia says
Excellent article we really need this to set up email for wordpress. I will definitely try this thanks for sharing.
Maggew says
Decent article yo. SMTP is great if you don’t send out more than 500 emails a month.
On my site, I use Amazon SES to deliver all mail. It’s affordable at like 10,000 emails for $1 and it’s 100% guaranteed to deliver into the inbox (assuming you setup / configured properly).
Abel says
I also vouch for Amazon SES. Have also successfully used MailGun for free.
Jeff Cohan says
I appreciate the tutorial. However, at this writing, the WordPress dot org plugin page for WP Mail SMTP shows that the newest version of the plugin (a) hasn’t been updated in 12 months; (b) is compatible only up to WP 4.0.8, and (c) is broken (6 of 8 votes) for WP 4.3.1. What do you advise?
WPBeginner Support says
We tested it and it works fine. If you enter the correct information in plugin settings, it would work.
Admin