Domain Filters

Domain filters block all email addresses from a specific domain. Instead of blocking addresses one by one, block the entire domain with a single rule.

When to Use Domain Filters

Block entire domains when:

  • A domain consistently sends bad or fraudulent addresses
  • You want to exclude competitor domains
  • You’re filtering out free email providers (gmail.com, yahoo.com)
  • A company is no longer a valid target for your campaigns
  • You’ve identified a spam trap or honeypot domain

Adding a Domain Filter

From the dashboard

  1. Go to Settings → Filters
  2. Click Add Filter
  3. Select Domain as the filter type
  4. Enter the domain to block (without @ or any prefix)
  5. (Optional) Add a reason for your reference
  6. Click Save

Add domain filter

Via API

curl -X POST https://api.truemail.app/v1/filters \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "filter_type": "domain",
      "value": "blocked-domain.com",
      "reason": "Known spam source"
    }
  }'

Domain Filter Rules

Format requirements

  • Enter the domain only (no @ prefix)
  • Automatically converted to lowercase
  • Must be a valid domain format

Valid examples

example.com
sub.example.com
company.co.uk

Invalid examples

@example.com           # Don't include @
[email protected]       # Don't include user part
https://example.com    # Don't include protocol
*.example.com          # No wildcards

Subdomain handling

Domain filters match the exact domain entered. To block subdomains, add them separately:

# This blocks emails @example.com only
example.com

# To also block subdomains, add them separately
mail.example.com
support.example.com

How Domain Filters Work

When validating an email like [email protected]:

  1. TrueMail extracts the domain part (blocked-domain.com)
  2. Checks if it matches any domain filter
  3. If matched, the email is immediately marked as “bad”
  4. No credits are charged

Example

You’ve added spam-factory.com to your domain filters.

Any email from that domain is blocked:

{
  "email": "[email protected]",
  "status": "bad",
  "reason": "blocked_by_filter",
  "credits_used": 0
}

Viewing Domain Filters

From the dashboard

  1. Go to Settings → Filters
  2. Use the filter dropdown to show only Domain filters
  3. Search by domain name or reason

Via API

curl -X GET "https://api.truemail.app/v1/filters?filter_type=domain" \
  -H "Authorization: Bearer YOUR_API_KEY"

Removing Domain Filters

From the dashboard

  1. Go to Settings → Filters
  2. Find the domain filter
  3. Click the Delete button
  4. Confirm the action

Via API

curl -X DELETE https://api.truemail.app/v1/filters/456 \
  -H "Authorization: Bearer YOUR_API_KEY"

Common Use Cases

Block free email providers

For B2B campaigns where you only want business emails:

gmail.com
yahoo.com
hotmail.com
outlook.com
aol.com
icloud.com
mail.com
protonmail.com

Block competitors

Keep competitor employees out of your marketing:

bigcompetitor.com
anothercompetitor.io

Block known spam domains

Domains that frequently appear in fake signups:

tempmail.com
throwaway.email
guerrillamail.com
mailinator.com

Block defunct companies

Former customers whose domain no longer exists:

old-company.com
acquired-startup.io

Bulk Import Domains

For large blocklists, use the API to import in bulk:

Python example

import requests

API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://api.truemail.app/v1/filters'

domains_to_block = [
    ('spam-domain1.com', 'Known spam source'),
    ('spam-domain2.net', 'Fake signups'),
    ('competitor.com', 'Competitor'),
]

for domain, reason in domains_to_block:
    response = requests.post(
        BASE_URL,
        headers={'Authorization': f'Bearer {API_KEY}'},
        json={
            'filter': {
                'filter_type': 'domain',
                'value': domain,
                'reason': reason
            }
        }
    )
    
    if response.status_code == 201:
        print(f"Blocked: {domain}")
    else:
        print(f"Failed: {domain} - {response.json()}")

JavaScript example

const domainsToBlock = [
  { domain: 'spam-domain1.com', reason: 'Known spam source' },
  { domain: 'spam-domain2.net', reason: 'Fake signups' },
  { domain: 'competitor.com', reason: 'Competitor' },
];

async function importDomains() {
  for (const { domain, reason } of domainsToBlock) {
    try {
      await fetch('https://api.truemail.app/v1/filters', {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          filter: {
            filter_type: 'domain',
            value: domain,
            reason: reason
          }
        })
      });
      console.log(`Blocked: ${domain}`);
    } catch (error) {
      console.error(`Failed: ${domain}`, error);
    }
  }
}

Best Practices

1. Use domains over individual emails

More efficient:

# One domain filter
competitor.com

Less efficient:

# Multiple email filters
[email protected]
[email protected]
[email protected]
...

2. Be careful with common domains

Think twice before blocking large providers like gmail.com—you might block legitimate users.

3. Document everything

Add clear reasons:

Domain: oldclient.com
Reason: "Client churned Jan 2024 - requested removal from all campaigns"

4. Review periodically

Domains can change hands. Review your blocklist to ensure it’s still relevant.

5. Consider your use case

  • B2B campaigns: Blocking free email providers makes sense
  • B2C campaigns: You probably want gmail.com, etc.