PostFix drop mail to specific account

Discussion in 'Server Operation' started by kule, Feb 1, 2008.

  1. kule

    kule New Member

    Hi There,

    I used the postfix guide on the site which worked a charm!

    Only one little niggle, I've currently got a catchall, but I keep getting spam to a specific address - e.g. lots of spam, always going to abc@mydomain.com.

    Is there a way I can just block all emails to that address?

    Thanks
    Luke
     
  2. falko

    falko Super Moderator

  3. kule

    kule New Member

    Cheers Falco, I'll take a look - will that work for BCC fields as well?
     
  4. falko

    falko Super Moderator

    I'm not sure... :eek:
     
  5. kule

    kule New Member

    *snip*
    Hmm no it doesn't work for Bcc fields - I'll have to look into another method.

    In case anyone wants to try this for blocking emails to a specific address in To: or Cc: fields:
    */snip*

    I tried sending a bcc email to myself and received it so I assumed it didn't work. However I haven't had any spam mail since so this must be working with BCC fields too! :D

    1) Add a line to your main.cf
    Code:
    header_checks = regexp:/etc/postfix/header_checks
    2) Create a new file, /etc/postfix/header_checks
    Code:
    /addresstoblock@yourdomain\.com/    DISCARD
    3) Restart postfix
    Code:
    /etc/init.d/postfix restart
    This will silently accept the email but not deliver it - if you wish you can use REJECT instead of DISCARD and it will send an undelivered message back to the sender.

    Cheers
    Luke
     
    Last edited: Feb 19, 2008
  6. jarif

    jarif New Member

    It can't work with bcc: fields, as there is no such fields in SMTP headers. header_checks do indeed check headers.

    Bcc recipient is entered by the protocol with RCPT-TO command, but otherwise bcc recipient is invisible.
     

Share This Page