Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I configure Postfix to silently drop / discard mails that were sent from one of my users to an external address?

I'm already able to discard all mails to external addresses using the following transport_maps

example.com      :
*          discard:

However I want to apply this rule to one user within my Postfix server only.

Also mails addressed to external and local addresses should get deliverd to the local users only.

Why do I need this?

The company I work at thinks that an intern should not sent mails directly to the customer. So the intern would send a mail using the customers address for to and adding his supervisor into the cc. Then Postfix shoud only deliver the mail to the supervisor so that he can check and sent the mail to the customer without searching for the customers address.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

To do what OP need, we need a check at transport level, which turn out to be simple.

  1. Add following line to /etc/postfix/main.cf

    sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport_maps
    
  2. Create /etc/postfix/sender_transport_maps as follow

    user@local.domain   discard
    
  3. Create postfix map file and restart postfix

    cd /etc/postfix
    postmap sender_transport_maps
    service postfix restart
    

This method works because postfix only use transport map for out-bound mail. In this case, instead of using a normal smtp service (smtp:), we use postfix DISCARD service.

share|improve this answer
    
This just discards all mails from that sender - but I want to discard external mails only (mails not ending with @example.com) –  Martin Dec 16 '12 at 22:54
    
So you want a specific user's email to a specific address be discarded? –  John Siu Dec 16 '12 at 23:02
    
Almost. I want a specific users's mails to be send to the local addresses only - external mails from this user should be discarded silently. –  Martin Dec 16 '12 at 23:42
    
ok, i have to revise the answer later. I am outside now and this is soemthing you don't keep in your head, lol. –  John Siu Dec 16 '12 at 23:46
    
no problem - and thank you for helping me! –  Martin Dec 16 '12 at 23:51
show 8 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.