0

Possible Duplicate:
How can I set up Postfix so that all email sent on my dev box gets routed to the developer email group?

I have a staging web server, and I have previously prevented any and all mail being sent out from it (I don't want my clients getting test messages from it). I've now set up postfix, but I want to restrict it so that the server only ever sends emails to recipients at one domain name. I've tried:

relay_domains = domain.com  
smtpd_recipient_restrictions = reject_unauth_domain

.. among other variations. I've just switched it to simply this to see if that made any difference:

smtpd_recipient_restrictions = reject

But it's still sending out mail. I think all I'm doing is changing the relay settings, and I need to be changing something else, but can't make head or tail of the documentation.

I'm running postfix reload after each change, and postfix restart. This is on Ubuntu server.

1
  • Please do not double post. If you wanted to draw attention to your older question you could have edited new detail in or put up a bounty.
    – Chris S
    Oct 14, 2011 at 19:42

3 Answers 3

1

I have a cheesy idea: set the smart host valid to an invalid ip address. Then emails that are local to the box will get delivered, but everything else will queue up waiting for delivery to that non existent host. Then just delete those every few days.

Another idea would be to use the transports file to redirect email for your customer domains to a non existent server. Or to a test server that is setup to accept email for all/multiple domains (such as your customer's domains).

1
  • Thanks Walter. Unfortunately, this blocked the emails that I wanted to be sent (which aren't hosted on the same box).
    – Dave Child
    Feb 11, 2011 at 12:06
1

This is the same idea as Walter provided, but more of an example with which you should be able to figure out what to do:

testbox:/etc/postfix# grep transport main.cf
transport_maps = hash:/etc/postfix/transport
testbox:/etc/postfix# cat /etc/postfix/transport
ourdomain.com     relay:[smarthost.ourdomain.com]
* local:
testbox:/etc/postfix# grep luser_relay main.cf
luser_relay = aLocalUser
testbox:/etc/postfix# postmap transport
testbox:/etc/postfix# 

Oh-- "aLocalUser" is of course a local user on your box that will receive all of the emails that aren't actually being delivered externally.

1
  • Thanks Unixguy. Sadly, although I should be able to figure out what to do from this ... it seems I can't. Is the ourdomain.com line configured to deliver email to our domain via the relay, and then anything else (*) set to just sit locally? This sounds like it will block all email delivered to other domains and deliver it to a local user - can I then have that mail delivered externally (to a developer group address, for example)?
    – Dave Child
    Feb 11, 2011 at 12:09
0

I asked this question a second time, and got a response that worked from rems. See How can I set up Postfix so that all email sent on my dev box gets routed to the developer email group?

Not the answer you're looking for? Browse other questions tagged .