Making Postfix Accept All Mail and Stick It In One Inbox

22 Feb 2010

I frequently find myself sending and receiving a lot of test email when I'm developing an application. I don't want to ever send any email directly from the SMTP server on my local machine, I just want all this email dropped into one mailbox where I can take a good look at it.

After a long, long time with qmail, I acknowledged the onward march of progress and acceptable licensing terms; I moved on to Postfix. I’ve found it offers me the balance of features that I want and need from an industrial-strength MTA, with excellent configuration flexibility.

To make your copy of Postfix drop all email into one mailbox, do the following:

Create a file called /etc/postfix/virtual, replacing username with your desired delivery target:

	/.*/ USERNAME

Next create a file called /etc/postfix/virtual_domains, with the single line:

	/.*/ MATCH

run postmap to compile these two files,

	postmap /etc/postfix/virtual
	postmap /etc/postfix/virtual_domains

You then need to add or change the following two lines in your /etc/postfix/main.cf

	virtual_alias_maps = regexp:/etc/postfix/virtual
	mydestination = regexp:/etc/postfix/virtual_domains

Restart postfix,

	/etc/init.d/postfix restart

…and all email will now be dropping into one inbox. If you need or want separate inboxes for testing purposes, the virtual_alias_maps file, /etc/postfix/virtual, is the place to look.

I pointed a super-fancy algorithm at this to try to automatically find some related posts, and the best it could do was Rotating Picture of the Earth as Ubuntu Wallpaper, Creating a Smoke Animation with Javascript and HTML Canvas, and Online Business: Choosing a Domain Name.

I have a handy list of all posts available on the blog, and you can find more information about me, and how to contact me, on my front page.

Subscribe

blog comments powered by Disqus