I have a VPS, with one external IP hosting <10 domains (DOMAIN.TLD). Each domain receives and sends email. Each domain has associated DKIM / SPF / MX entries. The PTR record exists and is associated with the main domain (MAINDOMAIN.TLD) on the VPS.
Mails end up in the spam folder (yahoo) for some receivers and do not get received at all by others (outlook). Gmail (and others emails hosted at different hosting providers like one.com) receives inbox immediately.
Not having a clear idea on how to configure each domain DNS in regards to email.
What I've done so far
Initially (the non-tested ones still have), each domain had an A record (mail.domain.tld ) and a MX record that pointed to the A record, but no PTR associated with the VPS IP. Email sending worked but I had Problem #1
A -> MAIL -> VPS_IP MX -> 10 -> MAIL.DOMAIN.TLD.
After finding out about and setting up the PTR record (which is the main reason why some email servers disregarded my emails, thus not having them received), I considered pointing each domain MX record to the domain resolved by PTR (MAINDOMAIN.TLD -> VPS_IP). I tried using CNAME to point and then directly MX to point.
CNAME -> MAIL -> MAINDOMAIN.TLD. MX -> 10 -> MAIL.DOMAIN.TLD.
MX -> 10 -> MAINDOMAIN.TLD.
In both cases, I had the same situation as described in Problem #1.
- What's wrong with the setup ?
- Whats the best way to approach this - having all domains using the MAINDOMAIN.TLD as MX (via CNAME or directly?) or having all domains using their own domain as MX ? (I think the 1st variant is to go for, because of the PTR record and the fact that I only have a single external IP address - but I'm not getting why it's not working)
- Are there any free and reliable (wanting too much?) external email providers that can handle email sending instead of doing it myself ?
Additional info that might be relevant
- how do I know DNS records are/were according to my description - using linux cli tools like host, dig, nslookup + https://mxtoolbox.com/
- i'm using ISPconfig3 as a hosting control panel
- the VPS is bought from DigitalOcean ,DNS management being done in the DigitalOcean dashboard
- SMTP server is postfix
- my IP is not blacklisted - checked with https://mxtoolbox.com/SuperTool.aspx?action=blacklist ; mail-blacklist-checker.online-domain-tools.com/
- nothing relevant in /var/log/mail.log - shows that emails are being sent but there is nothing answer related