Email being delivered to junk box

Posted November 27, 2018 1.4k views

I set up a Postfix/Dovecot virtual domain mail server on a Centos 7 Droplet. I am running 2 domains we’ll call and My server is and is pointed to the same IP I have MX and SPF records as well as a mail CNAME DNS record. I also installed MySQL and Roundcube Web Mail client. I built SSL certificates for my domains but I am using actually to serve up smtp and imap using SSL ports 993 and 465. Everything works great except when I send an email to my account using the email goes to junk/spam. Sending an email from goes to the inbox as expected. I added an SPF record to my domains but that didn’t change anything. I currently use a hosting service for my main domain which is not involved in this exercise and uses a common secure mail server address that is different from my domain and those emails get delivered to my gmail inbox correctly. I am sure there is something I need to configure in Postfix but have not figured it out yet. Hoping someone will recognize the issue and help me out. Thanks in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hey friend,

I wrote up something for this a while back, because I found that I was continually typing the same answer to the question, so I decided to make it a giant copy/paste. I deal with email more than I would wish on anyone, this is the best of my knowledge gained along the way:

There are a lot of reasons why e-mail may land in spam folders. To get a quick opinion on it, you can visit the link below and send an e-mail to the address that it generates you. This will give you a full report on how your e-mail appears to recipient servers.

These are the most common reasons why e-mails are filtered to spam folders:

  1. Inconsistent headers
  2. PTR lookup failure / no DNS record matching PTR
  3. SPF Failure
  4. Content

Inconsistent headers could be something like you sending from your server but in the “From” field it shows that it was sent from somewhere else, like Yahoo, Hotmail, etc. The “From” field should show an address that your server should be sending as (typically your domain).

You should make sure that your server’s hostname is a fully qualified domain name (example: and that the droplet is named to match, so that the PTR record is set. Additionally, your DNS should have that hostname (example: pointing to your droplet IP address so that reverse lookups are consistent.

Your SPF record is a DNS record of the type “TXT” which includes either a reference to a DNS record that points to your droplet IP address or the droplet IP address itself. For example, if I want to send mail as and I want to send from my website, as well as a droplet with the IP of, my SPF record might look like this:

“v=spf1 +a +ip4: ~all”

The “~all” tells the receiving mail server to basically do what it thinks is best if the mail does not match the “+a” (domain’s primary A record) or the “+ip4:” (the droplet’s IP address). You can also use “-all” instead which suggests to the recipient mail server that any e-mail not originating from these points should be discarded.

Finally, content. Your content can be read as spam whether you intend for it to be or not. Try sending e-mails without long signatures, images, brand names, or website names to rule out the content of your e-mails. However, keep in mind that past content can impact your future e-mails as well.

Now, it is important to note that the most common belief is that blacklists cause filtering to spam folders. In most cases, blacklisting will actually cause e-mail rejection, not filtering to spam folders. However, it is certainly a possibility, even if not a probability, that blacklistings can impact what folder your e-mails land in. You can look up blacklistings for your IP address here:

Do note that not every blacklist is relevant. Recipient servers have to actually use them for them to matter. Many are not widely used, and therefore do not matter. If you question whether this is the case with a particular blacklist, feel free to ask us, we generally know which ones are important.


  • Thanks for the good info, don’t have time for a complete research until tomorrow, will get back with results. I did go to the web site you suggested and got a pretty good score 9 of 10. The one I missed was the one I was worried about, not fully authenticated. There are some suggestions I need to evaluate. Thanks again for the good test site.

    I did one last test for today, I ran the test using the email and got the same results as the was not diverted to spam and was diverted to spam. The reverse DNS test seems most interesting but failed that test also??? So I will look into this further.

    • Looked into this quite extensively today and have not come to a conclusion. As it turns out Google will tell you ‘Sort of" why they don’t like your email. The reason they had for me was my email was similar to other that went to Spam. Not a very good explanation so I can always put the address in the address book and that will work but I want to avoid that so I can send emails to others with confidence that they won’t go to spam at google or other like providers. SOO at this point I want to consider all the options. There are several and the one I’m gravitating to most is the reverse dns option. But I have to say none of my other email accounts have good reverse dns. Matter of fact my setup is configured better than any of my other hosted products. One question I would ask, is there a book you would recommend regarding setting up and managing a email server.