Here I will discuss some common errors and their solution:
We are using a mail relay setup for sending and receiving the emails. So before starting with setting up mail services, you need to configure email relay. Please refer the document here to see how can you configure it on the mail server.
If you are still facing any issue after setting up the mail relay, please check the following:
1. Check whether the MX records and DNS records are correct
When we experience an email problem, the first thing to check is the MX record. An MX record(mail exchanger record ) is a type of resource record in the Domain Name System that specifies a mail server responsible for accepting email messages on behalf of a recipient's domain, and a preference value used to prioritize mail delivery if multiple mail servers are available. If the MX record is not pointed to the correct mail server, you will experience email issues especially with receiving emails. You can use any DNS checking websites where you can check whether your MX record is correct or not.
2. Check whether your domain is blacklisted or not
After correcting your DNS records, the next step is to check whether your domain is blacklisted or not. Most email providers have an anti-spam feature that essentially blacklists certain email addresses if they are deemed unwanted. How this happens is when a successful phishing attack (from an address that is forged from reliable accounts to try to recover personal information) is executed, then the email device deems the address to be spam, and proceeds to blacklist the address. So, the next step is to check whether your email address is blacklisted in any of the blacklists or at the destination domains. In order to check this, you can use any of the blacklists checking websites such as MX Toolbox.
Now after checking for blacklists, if you are listed in any of the blacklists, then you may submit a request at the blacklists to whitelist your domain. In MX Toolbox, you may click the details and scroll to the bottom page, there you may find the link for submitting the request.
3. Authenticate your email address
We have discussed some ways to check blacklists, now we need to know how your domain or IP get blacklisted. Suppose, you’ve been having some trouble with Russian spambots. Your end users have been complaining about receiving email bounce notifications from addresses they’ve never seen or sent messages to. You realize that someone is clearly sending fraudulent emails from your domain. If this continues, then the recipients may block you or blacklists your domain or IP from sending emails.
In order to prevent this, we should authenticate your domain .i.e, make sure that the emails are coming from the legitimate account itself. Email authentication allows ISPs to properly identify the sender of the email so it can make smarter decisions about the delivery of your mail. Authentication has become a best practice for email senders since spammers have gotten really smart about disguising malicious email under the veil of a trusted brand.
One quick method to improve your email delivery rates is to incorporate SPF(Sender Policy Framework), and DKIM, domain keys identified mail, into your DNS settings. With this addition to your DNS entries, you're telling recipients that you've authorized to send emails on your behalf.
An SPF record is a type of Domain Name Service (DNS) record that identifies which mail servers are permitted to send email on behalf of your domain. The purpose of an SPF record is to prevent spammers from sending messages with forged From addresses at your domain.
DKIM is an extension of DomainKeys which uses the same style DNS records. For details see http://www.dkim.org. There are basically two types of DNS records used by DomainKeys; policy records and public key records.
4. Understanding common error codes and troubleshooting steps:
After checking the DNS records, then the next step is to analyze and understand the error message or bounce back message received while trying to send the emails. The easiest way to resolve an email issue is to analyze the bounce back received. It actually contains the information why your email was rejected.
After getting the bounce back message, look for the error code. An error code will be a 3 digit number. In an email issue, this error has huge importance and each conveys a particular information. The first one defines whether the server has accepted the command, fulfilled an action, run into a temporary issue, encountered an error etc; the second and the third one refine the description further, stating if there's been a syntactic problem, or a connection trouble etc.
Among these errors, the ones starting the 5** are the permanent errors and needs to be resolved. If you get an error starting with 5**, then this is a permanent error. The errors starting with 4** are temporary errors and can be resolved after trying after some time.
Below are some of the common 5** errors and instructions on how to resolve this:
500
This is a syntax error: the server couldn't recognize the command. It may be caused by a bad interaction of the server with your firewall or anti-virus. Read carefully their instructions to solve it. In this, the error usually includes a link which describes the error and ways to resolve this.
501
Most of the times, it's due to an invalid email address, but it can also be associated with connection problems (and again, an issue concerning your antivirus settings).
502
The command has not been activated yet on your own server. Contact your provider to know more about it.
503
In case of "bad sequence", the server has pulled off its commands in a wrong order, usually because of a broken connection. If an authentication is needed, you should enter your username and password.
510/511
One of the addresses in your TO, CC or BBC line doesn't exist. Check again your recipients' accounts and correct any possible misspelling.
512
Check again all your recipients' addresses: there will likely be an error in a domain name (like [email protected] instead of [email protected]).
513
Double check your recipients' addresses and correct any mistake. If everything's ok and the error persists, then it's caused by a configuration issue (simply, the server needs an authentication).
523
Re-send your message splitting the list in smaller subsets.
530
Configure your settings providing a username+password authentication. If the error persists, check all your recipients' addresses and if you've been blacklisted.
541
Your message has been detected and labeled as spam. You must ask the recipient to whitelist you.
550
Though it can be returned also by the recipient's firewall (or when the incoming server is down), the great majority of errors 550 simply tell that the recipient email address doesn't exist. You should contact the recipient otherwise and get the right address.
551
It's a (not very clever) strategy to prevent spamming. You should contact your ISP and ask them to allow you as a certified sender.
552
Try to send a lighter message: that usually happens when you dispatch emails with big attachments, so check them first.
553
Check all the addresses in the TO, CC and BCC field. There should be an error or a misspelling somewhere.
554
The incoming server thinks that your email is spam, or your IP has been blacklisted. Check carefully if you ended up in some spam lists.