π₯ aaPanel Email Not Sending to Gmail β SPF, DKIM & DMARC Setup (2026 Guide)
Are your emails:
β Not reaching Gmail inbox?
β Landing in spam?
β Getting rejected with authentication errors?
If youβre using:
Then this guide will help you configure SPF, DKIM, and DMARC properly for Gmail delivery.
β
π¨ Why Gmail Rejects VPS Emails
Gmail checks three critical authentication layers:
β SPF (Sender Policy Framework)
β DKIM (DomainKeys Identified Mail)
β DMARC (Domain-based Message Authentication)
If one fails β spam or rejection.
β
π§ How Email Authentication Works
When your server sends an email:
Gmail checks if your IP is allowed (SPF)
Gmail checks digital signature (DKIM)
Gmail checks domain policy (DMARC)
Gmail checks reverse DNS
Gmail checks IP reputation
All must align.
β
β
STEP 1: Set Proper Mail Hostname
Before DNS setup:
Inside aaPanel β Mail Server:
Set hostname to:
$$
mail.yourdomain.com
$$
Restart mail service.
Also ensure:
$$
mail.yourdomain.com β YOUR_SERVER_IP
$$
β
β
STEP 2: Add SPF Record
Go to your DNS provider (for example, Cloudflare).
Add TXT record:
$$
Type: TXT
Name: @
Value:
v=spf1 mx a ip4:YOUR_SERVER_IP all
$$
What this does:
β Authorizes your VPS IP to send emails for your domain.
β
β
STEP 3: Enable DKIM in aaPanel



4
Inside aaPanel:
Mail Server β Enable DKIM
Youβll see a TXT record like:
$$
default._domainkey.yourdomain.com
$$
Copy the full TXT value.
Add it to DNS as:
$$
Type: TXT
Name: default._domainkey
Value: (paste DKIM key)
$$
Save.
This digitally signs outgoing emails.
β
β
STEP 4: Add DMARC Record
Add another TXT record:
$$
Type: TXT
Name: _dmarc
Value:
v=DMARC1; p=none; rua=mailto:postmaster@yourdomain.com
$$
What it does:
β Tells Gmail how to handle failed messages
β Improves trust
Later you can change:
$$
p=none β p=quarantine β p=reject
$$
After confirming proper setup.
β
β
STEP 5: Configure Reverse DNS (PTR)
Contact your VPS provider and request:
$$
YOUR_SERVER_IP β mail.yourdomain.com
$$
Forward and reverse DNS must match.
Without PTR β Gmail distrusts your server.
β
β
STEP 6: Install SSL for Mail Subdomain
Install Letβs Encrypt SSL for:
$$
mail.yourdomain.com
$$
Use:
SMTP: 465 (SSL)
IMAP: 993 (SSL)
Never proxy mail through Cloudflare.
Set mail DNS to DNS Only (grey cloud).
β
π How To Test If It Works
Send test email to Gmail.
Open message β Click βShow Originalβ.
Check:
$$
SPF: PASS
DKIM: PASS
DMARC: PASS
$$
If all PASS β your setup is correct.
β
β‘ Quick Setup Checklist
| Item | Status |
| Mail hostname set | β
|
| SPF added | β
|
| DKIM enabled | β
|
| DMARC added | β
|
| PTR record set | β
|
| SSL installed for mail | β
|
| Mail not proxied via Cloudflare | β
|
β
π Best Deliverability Practices (2026)
β Warm up new VPS IP slowly
β Avoid sending bulk immediately
β Use proper subject lines
β Avoid spam trigger words
β Keep reverse DNS aligned
β
#aaPanel #SPF #DKIM #DMARC #EmailDeliverability #GmailFix #VPSMail