Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

First, a description of what I'm trying to do here:

  • Incoming mail should be directed to a script (PHP, specifically, but it shouldn't matter)

    • Afterwards, the mail should be discarded (not sent further)
    • This goes for all incoming mail, regardless of what the destination is
    • Domains are not related (and are in fact random), just using a random sequence of letters/numbers for the domain name and address; keeping a list of these is inefficient and likely not possible
  • Outgoing mail (from the local system only; no relaying outside mail) should be sent on normally

As an example, if our server receives an email for example@example.org, it should pass that e-mail to a script and then discard it.

The question How do I get Postfix to deliver ALL mail to a custom script? seems to cover part of the first dot, but the current major stumbling block is accepting mail from all domains. When I try to send mail right now, I get rejected with a "Relaying access denied" error.

All of the information I've seen so far only mentions using wildcards like "@domain.com", which isn't very useful. I've been searching around and so far can't find anything that explains how to do it to someone who hasn't messed with Postfix before (and nobody can confirm that they're working in the first place, as the answers weren't accepted).

share|improve this question
add comment

1 Answer

This can be done in two ways. The first one is hacking with one instance and that would lead to a very ugly configuration.

The second option would be to use the Multi Instance approach where the first instance acts as described in your referenced question and this question. The second instance is then used only for outgoing mails. If you have a problem while sending mails via sendmail from the second instance, then you can see the solution in this answer.

share|improve this answer
    
That doesn't really solve the problem of not knowing how to set it up in the first place, but I guess that's a useful anecdote for later... –  Xkeeper Jan 9 '12 at 23:03
    
You've read the manual in this few minutes? And found it worthless?! –  mailq Jan 9 '12 at 23:04
    
Thanks for assuming I haven't read the manual, I thought we got past the age of blind RTFM replies last decade. Guess not. But yes. I have. Then I asked friends. Failing to get anywhere after trying other solutions, I asked the internet. You've been a great help, thanks a ton. –  Xkeeper Jan 10 '12 at 17:14
add comment

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.