Docker-mailserver: How to block all emails from specific domain or particular email address?

Created on 22 Oct 2020  路  5Comments  路  Source: tomav/docker-mailserver

I read through readme.md and wiki - Email filtering w/ Sieve. But not really find the answer I need.

What I want to achieve is quite basic, just block emails from particular sending address or domain.
Such as block all email from @abuse.com, or [email protected]. Matched emails can be rejected or discarded.

Is there easy way to put unwanted domains into a postfix config file at server level or I have to use Sieve email filtering?

Thanks.

help wanted priority 3 [LOW] question wontfix

Most helpful comment

  • Use Postfix smtpd_recipient_restrictions (https://github.com/tomav/docker-mailserver/wiki/Setup-docker-mailserver-using-the-script-setup.sh#email)
    Add to config/postfix-send-access.cf
    [email protected] REJECT

  • Use Spamassassin (https://github.com/tomav/docker-mailserver/wiki/FAQ-and-Tips#how-can-i-manage-my-custom-spamassassin-rules)
    Add to config/spamassassin-rules.cf:
    blacklist_from [email protected]

  • Use Sieve (https://github.com/tomav/docker-mailserver/wiki/Configure-Sieve-filters)
    Add to config/[email protected]:

require ["fileinto", "reject"];

if address :contains ["From"] "[email protected]" {
   fileinto "INBOX.spam";
} else {
     keep;
}

All 5 comments

I will mark this appropriately (and as wontfix, since this is a question not actually regarding _docker-mailserver_), but to be honest, this issue tracker is not designed to answer this kind of question, since https://www.google.com should be sufficient:)

  • Use Postfix smtpd_recipient_restrictions (https://github.com/tomav/docker-mailserver/wiki/Setup-docker-mailserver-using-the-script-setup.sh#email)
    Add to config/postfix-send-access.cf
    [email protected] REJECT

  • Use Spamassassin (https://github.com/tomav/docker-mailserver/wiki/FAQ-and-Tips#how-can-i-manage-my-custom-spamassassin-rules)
    Add to config/spamassassin-rules.cf:
    blacklist_from [email protected]

  • Use Sieve (https://github.com/tomav/docker-mailserver/wiki/Configure-Sieve-filters)
    Add to config/[email protected]:

require ["fileinto", "reject"];

if address :contains ["From"] "[email protected]" {
   fileinto "INBOX.spam";
} else {
     keep;
}

@x-Felix did the answer from @myavchik solve your issue?

Thank, it works as expected.
NOQUEUE: reject: RCPT from mail-oi1-f196.google.com[209.85.167.196]: 554 5.7.1 <[email protected]>: Sender address rejected: Access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-oi1-f196.google.com>

I read through readme.md and wiki - Email filtering w/ Sieve. But not really find the answer I need.

Could you please add the solution to the wiki?

Was this page helpful?
1 / 5 - 1 ratings

Related issues

alen12345 picture alen12345  路  4Comments

domdorn picture domdorn  路  4Comments

42wim picture 42wim  路  4Comments

xiao1201 picture xiao1201  路  4Comments

Mathieu-R picture Mathieu-R  路  4Comments