PDA

View Full Version : Postfix - How to block mails to some address?


thavaht
11th September 2008, 13:29
Hi all,

Is there any way to tell postfix to no longer accept messages to some user mail address in my domain without deleting the account?

Any help will be appreciated.

thavaht

memphis
11th September 2008, 13:37
Hello,
some time ago i have looked for a similar solution.

Here ist my try in the german forum: http://howtoforge.de/forum/showthread.php?t=696

Translation:

I have created a file in which i wrote:

/^To:.*spammer@domain\.de/ REJECT

This file i named header-ckeck.pcre

And in the postfix main.cf i fill in this line:
header_checks = pcre:/etc/postfix/maps/header_check.pcre

in
smtpd_data_restrictions

thavaht
11th September 2008, 14:49
Hi Memphis,

Thank for your prompt reply. I’m still in doubt.

The address I want to block mails to is: info[at]ests[dot]ac[dot]mz

So under /etc/postfix/maps/ I created the file header_check.pcre with the following content:
/^To:.* info@ests\.ac\.mz/ REJECT

In the postfix main.cf I added the following line:
smtpd_data_restrictions =
header_checks = pcre:/etc/postfix/maps/header_check.pcre

Is that correct?

falko
12th September 2008, 18:19
You can do this with the /etc/aliases file. Put something like
web1_someuser: /dev/null (where web1_someuser is the username of the account for which you don't want to receive emails anymore) in it, run newaliases afterwards and restart Postfix.