Why should you setup SMTP in WordPress? How can you do it?
WordPress uses a PHP function called “mail()” to send emails from contact forms, blog comments and store orders.
This functions well in most sites, but in some server configurations, this default mode of mail configuration won’t work.
That is where setting up SMTP in WordPress can come to your rescue.
Here at Bobcares, we see WordPress mail errors everyday as part of our Outsourced Technical Support services for web hosting providers.
Today we’ll go through the top 2 causes for this error, and how to fix it by setting up SMTP.
Why are WordPress emails blocked by some servers?
WordPress uses an inherently vulnerable PHP function (called mail()) to send emails.
This function injects a mail directly into the web server’s mail queue without checking if it is authenticated.
Spammers use this vulnerability all the time to send spam.
To prevent this, hosting providers set various restrictions on their servers.
Two common things are:
- Disabling PHP mail() function – Server hosts disable PHP mail function on the server to avoid such spam/abuse issues.
- Setting Email limits – To limit the impact of spamming, hosting provider set limits on the volume of emails sent from your domain.
How to fix the WordPress email delivery issues?
Website owners still have a way to send emails from their websites emulating a email client like Outlook, Windows Mail, etc..
You can configure your WordPress to send emails from your web server or using any third party email providers such as Gmail, Yahoo, Outlook etc.
This can be implemented using:
- SMTP plugins.
- wp-mail() function modified to work with SMTP.
The quicker way is to use WordPress SMTP plugins.
Today, let’s discuss in detail about the first solution.
How to Configure SMTP Plugin?
One of the popular SMTP plugin is “WP Mail SMTP“.
Once this plugin is activated, ‘Email‘ menu will show up under the ‘Settings‘ in WordPress dashboard. You can configure the SMTP settings in that option.
You can give your email account name, password, mail server name, SMTP port and type of encryption in the email settings.
Configure the following in your SMTP settings.
From Email : Email ID to appear as "FROM". From Name : The sender's name. Mailer : Your email server (Gmail, Mailgun, SendGrid or any other SMTP server). SMTP host : The hostname of your mail server. SMTP port : Outgoing port of mail server. Encryption : Either SSL or TLS encryption. Authentication : Turn on SMTP authentication. Username : Email account username. Password : Account password.
Yeah, it looks easy, but it may not work always.
Here are a few common errors we’ve seen while configuring SMTP plugins, and how we fix them.
What are the common errors you face with WordPress SMTP plugins?
In our experience of handling wordpress issues, let’s see the common errors you face with WordPress SMTP plugins and the reasons for that.
1. SMTP Error: connect() failed
The common causes of this error are incorrect settings in your SMTP plugin, your hosting provider is blocking the outgoing connection to the SMTP server, security restrictions by 3rd party servers such as gmail or email apps.
2 . SMTP Error: Data not accepted
SMTP server is rejecting your email message because it contains something not allowed by the SMTP server rules such as the file size of your message is too large, your server doesn’t allow the from email address different from the email address used to authenticate, etc.
3. SMTP Error: Could not connect to SMTP host
This can be due to security restrictions in the server like “SMTP Restrictions”, “Restrict outgoing SMTP”, firewall rules to block the connectivity to the SMTP port, security restrictions by third party email providers.
4. SMTP Error: Could not authenticate
WordPress can connect to the SMTP server, but it can’t authenticate.
This can be caused by incorrect details used in your SMTP plugin settings. (double check the username, password, port and the encryption used).
This list is not complete. You can come across with n number of errors while configuring your plugin.
At Bobcares, we have teams with hands on experience in WordPress customization and in troubleshooting WordPress issues.
If you need help fixing the errors in your WordPress application, click here to talk to our WordPress experts. We are online 24/7.
Many hosting companies block PHP mail() function to curb spamming. This prevents WordPress from mailing out. Today we’ve discussed how to work around this limitation by setting up SMTP in WordPress.