Postfix magician needed. Inquire within.
December 8, 2009 1:03 PM   Subscribe

Postfix Setup: I have an internal postfix server that is relaying mail for our test environment. I never want this server to send email to the world at large. I want the email to end up in a single mailbox.

I'm not a sysadmin, but I play one on TV.

I have a test environment that relays email off postfix. Some of the addresses are good internal addresses that I want to relay. But some of them are production customer addresses that I never in a million years want to send email to.

I was thinking there must be some postfix juju I can use to make it so that internal addresses are delivered normally (*@mydomain.net), but anything else is deemed external and will just be filtered to one local mailbox. Then I could setup a web mail program to access this mailbox so people can validate test results.

Can anyone help with the necessary postfix magic? I have full access to all configuration on the server.

For webmail, what should I use? squirrelmail? horde?

Thanks, hive mind.
posted by cmm to Computers & Internet (10 answers total)
 
There will be documentation somewhere on what you're trying to do. Postfix is well travelled.

Your question makes you come across as inexperienced and wanting someone to solve your problem for you. I would be surprised if you get any other responses to your question.

I know zimbra will do what you're asking about with an easy to use web administration interface, that might be more your speed, and it uses postfix 'internally', but is quite a hefty package compared to standalone postfix. I'm not saying it'll be any easier to figure out, sort out and setup than what you have so far with postfix.
posted by BurnMage at 2:14 PM on December 8, 2009


Response by poster: And no offense, but isn't "someone solving your problem for you" what Ask Mefi is for?

I've tried to find what I want from postfix documentation. I have been unsuccessful. I have figured out how to use the postfix transport map to relay some addresses off one relay and treat others as local. But I have not managed to figure out how to funnel everything else to one readable normal user mailbox.

I am unexperienced with this. If I knew what I was doing I may not need help. If I knew better terms for what I was trying to do, I could probably do better google searches. But I don't!

I'm hoping someone else has done what I want to do already and can get me pointed in the right direction. If no one answers then no one answers. And I'll cry myself to sleep tonight. Late. After playing with postfix way too long.
posted by cmm at 2:22 PM on December 8, 2009


Best answer: Hi,

This will do what you want:

http://www.postfix.org/VIRTUAL_README.html#forwarding

manually forward all test accounts and catchall for any others.

Roundcube is good for web mail.
posted by gadha at 2:48 PM on December 8, 2009 [1 favorite]


oh, this assumes you are relaying mail using the "relayhost = smtp.server.name" command
posted by gadha at 2:59 PM on December 8, 2009


oops, I didn't catch your earlier comment. A map of the form:

a@test.mydomain.com a@mydomain.com
b@test.mydomain.com b@mydomain.com
@test.mydomain.com mailbox@mydomain.com

seems to work for me
posted by gadha at 3:05 PM on December 8, 2009


CMM - Gadha has it. Setting the relay will allow your test box to send to your production server just make sure this is allowed on your prod mail server.


Burnmage - dude, seriously.
posted by anti social order at 3:14 PM on December 8, 2009


Response by poster: I'm relaying right now based on a transport map. So I have certain addresses I relay off our exchange server, some are relayed off another internal only email relay, and the rest I was delivering normally before.

In order to stop external emails, I changed my transport map to deliver anything not matching my internal domains to the local transport which would then bounce the mail as undeliverable.

The problem isn't the mydomain email. The problem is that we have email addresses in databases restored from our customer environment for reproducing issues, but we do not want to ever accidentally email any of them. We try to scrub them, but sometimes things squeeze through.

So it's like I want a virtual map setup that has *@* go to a specific local address and have that as the catchall. I guess maybe that is a valid virtual alias that I can just put last though in the list and then use the virtual transport instead of the local transport. Hmm. I knew I could do a catch all for *@domain.com. But I guess nothing would stop me from using *@* and sending it to my catch all local address which will match one of the earlier transport map entries so it doesn't cycle.

Fingers crossed. Thanks for the help, Gadha.
posted by cmm at 3:25 PM on December 8, 2009


Best answer: It sounds like something I did:

I set up a transport map:
-------TRANSPORT-----
my-email@work-domain.com :
test-account@work-domain :
* discard:
------END--TRANSPORT----
discard is the transport for essentially /dev/null.

Then in main.cf I added:
always_bcc = my-email@work-domaincom


This way, I'm bcc'ed on all mail, anything for my-email and test-account gets delivered as normal with everything else just tossed out.
posted by MikeKD at 5:44 PM on December 8, 2009


I've done exactly this to set up a test application server which sends mail and interfaces with Mailman on my laptop. I set it up so every outbound mail gets dropped in a single local maildir. I'll see if I can dig mine up.
posted by vsync at 7:06 PM on December 8, 2009


Response by poster: So, what I ended up doing which seems to be working well for now:

1) Transport map:
# Route local stuff normally
thishost.localdomain.net :
thishost.localdomain.com :
.thishost.localdomain.net :
.thishost.localdomain.com :

# Route internal stuff through exchange
localdomain.net :[exchange.localdomain.net]
localdomain.com :[exchange.localdomain.com]

# Everything override to send to the local transport which we will
# funnel through luser_relay in main.cf
* local:$myhostname

2) In main.cf, set:
local_recipient_maps =
luser_relay = emailtrap+$user

3) reload postfix configuration

4) Setup courier-imap and courier-authlib for imap

5) Setup RoundCube to hit courier-imap

Other than RoundCube lets me send email as emailtrap@thishost.localdomain.net, I'm happy. I could probably set the SMTP address in RoundCube to some bogus place to stop this I guess.

Thanks all for the help.

vsync, I'd still be interested in what you did just out of curiously.
posted by cmm at 2:50 AM on December 9, 2009


« Older Can switched bank accounts equal automatic...   |   What type of tracking number is this:... Newer »
This thread is closed to new comments.