DEV Community

Cover image for Fixing System Mailing Issues On WordPress
🎧Cirphrank👣
🎧Cirphrank👣

Posted on

Fixing System Mailing Issues On WordPress

In this post, I'll keep it as layman as possible and as concise as possible, such that even if you are not a developer, you'll find this easy to apply. Without any ado, let's get to it.

Problem: custom mail won't work, the system not sending out mail, e.g. registration confirmation mail.

Solution: USE an SMTP Plugin or Update SPF records.

Using an SMTP.

What a Similar Mail Transfer Protocol does is; evade the use of the PHP mail () function which is the default way your WordPress system uses in executing mail transfer, and proceeds to connect your WordPress system to a 3rd party mailing protocol to send emails instead, most people by default opt for SMTP plugin without even having any issue because most of them come with the option to configure the sender's name for your website whenever a mail is being sent out, something which the mail() function defaults to some wordpress@blablaba kinda name...

But when your WordPress website stops sending out emails for whatever reason (which you may easily find the answer to by chatting up your hosting platform customer care), installing a plugin like WP Mail SMTP and configuring it PROPERLY will fix it. For me, I use: Fluent SMTP, none of these mentioned plugins has any affiliation to me.

Install, activate, goto it's settings.

For the host, on an easy day, it will be your website's URL or smtp.yourwebsitename.tld or simply putting local host might even work.

What certainly works though is: going to your website URL/webmail, then copying the URL that's in the address bar when the page opens, leaving out the column and numbers at the end, you'll have something like: server182.web-hosting.com - that is your host!

For Port: 465

587 or 27 are also indulgeable.

For encryption, use that which your site has, most likely SSL, if you are unsure, use TLS.

For username and password, use the login credentials to the email address you'd like your website to send mail as, as this whole guide is based on the presumption that you are using a mail created from your hosting's CPANEL, something like mailengine@yourwebsite.com (I like to use mailengine for the name of the address of my system's auto emails get sent through😉) if you didn't have one earlier, log into your hosting account CPanel and set one up via the email section.

If you're using any other mail client like Gmail and that's what you want to stick with, you'll have to read up their documentation on how to connect the system to an SMTP plugin. (mostly involves more hassle than CPanel-based webmail will give)

When you've entered those credentials, that's it, click save or connect or whatever the plugin's last button for execution is, and you are good to go, mails should start getting sent now.

But if after doing that, symptoms persist, then you possibly never needed to do that, the only thing that was ever wrong was not a mail() function getting disabled by the hosting company or something, it was a DNS record mishap, and you can quickly realize this from the subject email account being impossible to set up on other system's like your phone's mail client.

SPF Solution

Google Image Search for SPF records

The cause of this is mostly DNS record mismatch or inexistence, which can occur when you newly switched hosting or you switched your secure server layer provider, like from your host to Cloudflare.

If it was a hosting package switch, just chat up customer care, tell them the problem and they'll update your SPF records and things will go back to being just fine. If you have switched to a 3rd party like Cloudflare, you'll need to ask them to kindly give you your domain's SPF records and you'll need to login to Cloudflare and update the records in the DNS section manually, and all will be well.

Footnotes:

Just in case you're curious: SPF is the sender policy framework, the record states all authorized servers that are allowed to send emails from your domain, hence you might want to treat them like a fragile pet.

Don't know how to create custom emails in CPanels? - https://docs.cpanel.net/knowledge-base/email/how-to-create-and-connect-to-an-email-account/

How to create DNS records in Cloudflare: https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/

TLD means top-level-domain e.g. .com .net .org ...

And that's it, comments or anything can come in in the comment section, Good day.

Image source: Pexels

Top comments (0)