0

Recently one of our company's accounts gets a target of spam mails. This account is already locked, but spam emails never end. Thus, I edit /etc/postfix/header_check file as follows:

/^To:[email protected]/ REJECT

I have tested whether I cannot send to a mail to this user and I confirmed that postfix successfully rejects it:) But, it cannot reject the spammer's mail since the header looks like:

To:< anyname> [email protected]

There is an any name in addition to the actual email address that the spammer changes every time. How can I reject this rule?

2 Answers 2

1

If the rule uses regular expressions (it looks like it does), then change

/^To:[email protected]/ REJECT

to

/^To:.*[email protected]/ REJECT

The .* allows for any string to occur between To: and targetuser@. Note that this will also reject emails sent to someothertargetuser since that would also match the expression.

0

Matching the header is not sufficient, as mails may have a different To address than the envelope recipient address. See http://www.linuxmail.info/postfix-restrict-sender-recipient/ for some hints on rejecting mails based on recipient address. Another solution might be to delete the recipient address completely, of course you can't do that if the mailbox contents are still needed and you plan on reactivating the address at a future time.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.