2

I ban and reject some spammer domains/IPs, via:

smtpd_recipient_restrictions = check_sender_access regexp:/etc/postfix/client_checks, ...

client_checks file:

/\@domain\./  REJECT

and it works fine, but I want to receive notification on postmaster or special email (bounce@example.com) every time the email is rejected and Delivery failure message is sent to sender(spammer).

I set up the following already in main.cf, but it doesn't work:

notify_classes = bounce
bounce_notice_recipient = bounce@example.com

Please, could you help me find out what I am doing wrong.

cmpt
  • 87
  • 1
  • 5

1 Answers1

1

You need to adjust the notify_classes parameter, to get notified about rejected emails.You may add the policy option to get notified about policy rejected mails. The options are explained here:

notify_classes (default: resource, software)

The list of error classes that are reported to the postmaster. The default is to report only the most serious problems. The paranoid may wish to turn on the policy (UCE and mail relaying) and protocol error (broken mail software) reports.

NOTE: postmaster notifications may contain confidential information such as SASL passwords or message content. It is the system administrator's responsibility to treat such information with care.

The error classes are:

bounce (also implies 2bounce)

Send the postmaster copies of the headers of bounced mail, and send transcripts of SMTP sessions when Postfix rejects mail. The notification is sent to the address specified with the bounce_notice_recipient configuration parameter (default: postmaster).

2bounce

Send undeliverable bounced mail to the postmaster. The notification is sent to the address specified with the 2bounce_notice_recipient configuration parameter (default: postmaster).

data

Send the postmaster a transcript of the SMTP session with an error because a critical data file was unavailable. The notification is sent to the address specified with the error_notice_recipient configuration parameter (default: postmaster). This feature is available in Postfix 2.9 and later.

delay

Send the postmaster copies of the headers of delayed mail (see delay_warning_time). The notification is sent to the address specified with the delay_notice_recipient configuration parameter (default: postmaster).

policy

Send the postmaster a transcript of the SMTP session when a client request was rejected because of (UCE) policy. The notification is sent to the address specified with the error_notice_recipient configuration parameter (default: postmaster).

protocol

Send the postmaster a transcript of the SMTP session in case of client or > server protocol errors. The notification is sent to the address specified with the error_notice_recipient configuration parameter (default: postmaster).

resource

Inform the postmaster of mail not delivered due to resource problems. The > notification is sent to the address specified with the error_notice_recipient configuration parameter (default: postmaster).

software

Inform the postmaster of mail not delivered due to software problems. The > notification is sent to the address specified with the error_notice_recipient configuration parameter (default: postmaster).

Examples:

notify_classes = bounce, delay, policy, protocol, resource, software
notify_classes = 2bounce, resource, software
Diamond
  • 9,001
  • 3
  • 24
  • 38
  • sorry my typing mistake, of course it is: notify_classes = bounce, delay, policy, protocol, resource, software but it is still doesn't work – cmpt Jan 22 '16 at 09:59
  • 1
    @cmpt, Well, may be you can try adding `policy` to `notify_classes` and `error_notice_recipient = bounce@example.com` to see what happens. – Diamond Jan 22 '16 at 10:09
  • 1
    Sorry, the right setting works is: notify_classes = policy thanks to all, the case is closed – cmpt Jan 22 '16 at 10:12
  • Just to explain what is happening: With your usage of `smtpd_recipient_restrictions` you REJECT mails and no bounce is generated on your system. (Which is absolutely the right configuration, btw.) – mschuett Jan 22 '16 at 10:13
  • no, bounce is generated now by: bounce_notice_recipient = bounce@example.com – cmpt Apr 14 '16 at 13:17