Mail delivered to spam a lot with my current setup

Hi, i`m struggling all the time with mail problems. A lot of mail gets delivered to spam by clients and lot of mails are not delivered at all.

I hope someone can help me to set things up correctly.

I have this as setup:

A VPS with the name is registrered and points to its own domain on another server is an A record to my VPS (resolves correctly)

On the VPS i have added one mainserver: (not used as website really).

I created a subserver for my website: This website is a subserver for (I changed the domainname afterwards, so the full domain is, not

In DNS I created these records for IN A IP.ADDRESS > IP adress is the IP of VPS CNAME to IN TXT “v=spf1 ~all”
MX 5 to

In DNS i created these records for IN A IP.ADDRESS > IP address of
MX 5 IN TXT "“v=spf1 a mx ip4:ipadres ?all”

This setup is working, but like 25% gets not delivered or is marked as spam. Basically the idea of this was to setup multiple domains with all the mailserver via

So resolves to, which MX record resolves to Srv1.myservers MX records resolves to and this resolves to

It seems like this could be setup lot easier and much more reliable, but this is completely new for me and I am glad I came this far already.

It would be awesome if someone could share the exact DNS settings for me I would use. (keeping in mind the setup of srv1, srv2, and that my actual website is a subserver in Virtualmin). If it is wrong to be a subserver le me know too, I could just make it a mainserver but thought this was better managable since I would go to /home/user/domains/ and all my websites were there instead of every domain having its own home directory.

Thanks a lot in advance!


Well, you may want to verify that you have reverse DNS setup on your main IP address (which is something your ISP/provider would need to enabled).

However, what you may want to try is to send an email to another server running SpamAssassin, and then review the mail headers to see what is spam-like about your emails. SpamAssassin will show you what rules were triggered.

Another thing you could try is to see if your IP address is listed on any of the common RBL’s, that’s a possible cause of what you’re seeing:

Hey! Thanks a lot, very helpfull for diagnostic debugging.

There is reverse DNS setup for the domain. That would be enough right, since that is the final mailserver sending the mails? Does it matter that mails sent from are sent via mailserver of

I will definitely try to sent mails to another server (luckily I have one with mail and spamassassin setup) and look into the headers. I think that will help a lot.

I checked for blocklists via your URL. Luckily I`m on no blocklist with

So, apart from these suggestions of your, is my DNS setup ok this way? Or is it a bad setup anyway?


In theory, what you’re describing should work.

There are a lot of variables involved though, seeing what SpamAssassin has to say about the issue by sending an email to another server can really help nail down the culprit.


Tracking this thread, was forced to leave a comment so…

I’m a comment. :slight_smile:

Thanks! I will dive into the logs of spamassassin. I wil post here if I discover something helpfull.

When sending an email to another server, check out the “X-Spam-Status” email header that SpamAssassin adds to that email. It will contain everything that it has to say about that email.


Thanks! I did already find out one problem, one DNS record was pointing to the wrong IP

Hi! I have one more question and hopefully someone can help.

Now my setup is as this: has MX record to has an MX record to, which points to the ip of

This is working, but I wonder would this be better: has MX record to has A record to

In the latter case, the MX records domain is the same as the A record for the mailserver. I don`t know if, but might this be better to prevent spam marking?

And for the first case, my TXT record is like this: v=spf1 a mx ip4:IPADDRESS ?all".
Don`t I need to inlcude in this TXT record, or add an addiontal TXT record for

Now mails are being sent from, but the server and everything goes to I can imagine that being a problem (since lot of spammers are impersonating like being someone else).

On my server, I have the following:	IN	A	<server_ip>	IN	MX	5	IN	TXT	"v=spf1 a mx -all"

I also believe that is how virtualmin creates records by default (not sure about the SPF record, as I didn’t have SPF creation enabled in server template when I created the virtual server)

I don’t think it matters either way however though. Someone who knows more about how mail servers work might be able to say if it does or does not with more authority then me :slight_smile:

Dustin Schreiber