Vannkorn

Full Stack Web Developer

Close

Quick Fix: Exim4 Rejecting Gmail Emails (Spamhaus RBL Issue)

This is a common issue caused by overly strict filtering, and fortunately, it’s quick to fix.

Ads: Register now via this link to receive $300 credit from Vultr

If your mail server (HestiaCP + Exim4) suddenly stops receiving emails—especially from Gmail—you might see errors related to Spamhaus blacklist checks. This is a common issue caused by overly strict filtering, and fortunately, it’s quick to fix.

The Problem

You may notice:

  • Emails from Gmail or Outlook never arrive
  • Exim logs show messages like:
Rejected because is in a black list at zen.spamhaus.org

This means your server is actively blocking incoming emails based on RBL (Realtime Blackhole List) checks.

Why This Happens

Exim is configured to reject emails immediately (deny) if the sender’s IP appears in Spamhaus.

The problem is:

  • Spamhaus sometimes lists shared IP ranges
  • Large providers like Gmail use shared infrastructure
  • Legitimate emails get blocked unintentionally

The Fix (Quick & Safe)

Instead of rejecting emails outright, you should allow them through and let spam filtering tools handle them afterward.

Backup Your Configuration

Before making changes:

cp /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf.template.bak

Change deny to warn

Open the Exim config:

nano /etc/exim4/exim4.conf.template

Find this line:

deny message = Rejected because $sender_host_address is in a black list…

Comment it out and replace it with:

warn message = Rejected because $sender_host_address is in a black list…

👉 This allows emails to pass through instead of being blocked.

Whitelist Trusted Mail Providers

Add these lines before any blacklist rules:

accept
hosts = *.google.com
accept
hosts = *.outlook.com

👉 This ensures emails from major providers are never rejected.

Restart Exim

Apply the changes:

systemctl restart exim4

The Result

After applying the fix:

  • Gmail and Outlook emails arrive normally
  • Spam filtering still works (via SpamAssassin or similar tools)
  • No more false-positive rejections

By keeping this approach in mind, you can ensure reliable email delivery while still maintaining effective spam protection.

Leave a Reply

Your email address will not be published. Required fields are marked *