HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Server Operation (
-   -   PostFix drop mail to specific account (

kule 1st February 2008 19:23

PostFix drop mail to specific account
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

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


falko 2nd February 2008 20:11

Take a look here:

kule 2nd February 2008 20:23

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

falko 3rd February 2008 20:18

I'm not sure... :o

kule 6th February 2008 16:19

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:

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

header_checks = regexp:/etc/postfix/header_checks
2) Create a new file, /etc/postfix/header_checks

/addresstoblock@yourdomain\.com/    DISCARD
3) Restart postfix

/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.


jarif 5th September 2012 01:01

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.

All times are GMT +2. The time now is 13:43.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.