If emails from your server go to spam: configure SPF, DKIM, DMARC, PTR record, and check your IP against blacklists.
Applies to:
✔ VPS
✔ Dedicated servers
✔ Any mail server
Add a TXT record for the domain:
v=spf1 ip4:SERVER_IP mx -all
For Postfix, install opendkim:
apt install opendkim opendkim-tools -y
opendkim-genkey -s mail -d example.com -D /etc/opendkim/keys/
Add the public key as a TXT record for mail._domainkey.example.com.
Add a TXT record for _dmarc.example.com:
v=DMARC1; p=none; rua=mailto:admin@example.com
dig -x SERVER_IP +short
dig +short 4.3.2.1.zen.spamhaus.org
If an IP is returned (e.g., 127.0.0.2), your address is blacklisted.
Send a test email to Gmail. Open it, click "Show original". Check: SPF: PASS, DKIM: PASS, DMARC: PASS.
Send a test email to an external address. It should arrive in the Inbox, not Spam.
If your IP is on blacklists, submit a removal request. If emails keep going to spam after all configuration, open a support ticket.