• contact
  • about
Home

redirect all outgoing email to a single account with postfix

rene — Wed, 01/28/2009 - 22:10

Lab environments can get fairly messy if not maintained and the gentle hand of a sysadmin is routinely applied. Security compliance is generally the last thing on a developers mind whilst hacking away at projects still in the development stage. Having lab databases filled with unobfuscated customer data which is never a good idea, is unfortunately common.

Im not condoning having real customer data in a lab environment, though it does happen and there is a real potential for a disaster to occur such as testing out your latest 'mass email 2.0' code on your lab database not realising that your lab data is actually a production data set. Oh yer, you also forgot to firewall outbound port 25/tcp aswell as well as having recursion available within your internal BIND9 view. Doh!@#

Heck, having your lab have any access to the intertubes is just a plain bad idea.. period.

Again, im not condoning this though you may want to catch all outgoing emails and redirect them to a single email account which can be viewed by fellow engineers and developers as a means of testing your features that can generate email.

Postfix can be setup to redirect all outgoing email to a single account. As long as your code hands email off to your MTA, this hack will do what you need. Your main.cf will need to look a bit like this.

relayhost = 223.1.2.1
bounce_queue_lifetime = 0
maximal_queue_lifetime = 0
always_bcc = rene@localhost

relayhost lets postfix know what is the next host to relay outgoing email through. For this hack, set relayhost to a bogus address. Setting this to a bogus IP address will force postfix to keep the email in its delivery queue without it actually reaching its next hop.

bounce_queue_lifetime defines the amount of time a bounce message is queued before it is considered undeliverable. Postfix will only attempt to deliver the bounce message once if bounce_queue_lifetime is set to 0.

maximal_queue_lifetime is the maximal time a message is queued before it is sent back as undeliverable. Again, 0 forces postfix to only attempt once.

Finally, always_bcc is the email account that will catch all mail. This account will also catch Non-Delivery Notifcation's which may become annoying though a little procmail fu will fix that.


photos im taking

Pancakes in the afternoon. NOMsThe Cuckoo in Olindaeastern beach, GeelongGeelong maestrohawthorn vs Geelong at the MCGSt Marys church in GeelongseaplaneMEGANOMSChristmas in July at Ms Marplesfound in old album store in sassafrasoutside tea store in sassafrasEarl and green teaphoto.JPGantique store in the dandenongschicken parmigiana at rangersbruschetta at rangers in the dandenongstimeball towerDO NOT USE 50 cents!!!veggie patch week 2Photo1.jpgPhoto1.jpgNOMS!!$@photo.JPGred shoesphoto.JPGRBGdance Eugene, dancejust hanging outRoyal Botanical Gardens in MelbourneRoyal Botanical Gardens in Melbourne

about me


Passionate Systems Engineer.
Want to know more?

connect with me

search rene.bz

what im reading

  • Pivoting 101
  • A word of advice from my father about being frugal.
  • Fighting the summer productivity blahs
  • App Update: BlurFX
  • The elements of change
  • The Life Changing Nature of Gratitude
  • Evernote Essentials: The definitive guide to using Evernote
  • 9 Expert Tips For Better Writing
  • Coburg, Melbourne #iphoneography
  • Media Exponential
  • Little Collins St, Melbourne #iphoneography
  • Google I/O 2010 - Making Freemium work
  • The 8 lies that software developers tell
  • Coburg, Melbourne #iphoneography
  • TED talks – What the world needs
  • It’s As If Apple Has Hired Don Draper
  • TechCrunch TV: Speaking Of… Detroit, Featuring Scott and Jay Adelson
  • Why the World Needs Google TV
  • Federation Square No. 4, Melbourne #iPhoneography
  • North Melbourne Station
more

what im bookmarking

  • mmmmail! - Free disposable Email to RSS service.
  • The New York Times > Style > Slide Show > Single Space
  • Puppet - Using Multiple Environments - Puppet Labs
  • Muscle Beach
  • Doctrine - Doctrine ORM for PHP - Coding Standards
  • Using CPAN with a non-root account
  • AdvancedNetworking - cobbler - Trac
  • Simple jQuery Tabs Plugin
  • HTML5 Demos and Examples
  • When can I use...
  • Les RPM de Remi - enterprise - 5 - remi - x86_64
  • RPM Search RedHat EL 5 mysql-5.1.48-1.el5.remi.1.i386.rpm
  • Index of /SRPMS
  • AspireOne/AO751h - Community Ubuntu Documentation
  • Vel2010
  • InterfaceLIFT: Wallpaper sorted by Date
  • Software « michaeldehaan.net
  • about-company | Next New Networks
  • PHP 5.3.2 RPMs for CentOS 5.4
  • Slicehost Forum - CentOS 5.4 and PHP 5.3.2
more

podcasts im listening to

  • Shot of Jaq » The War Of The Editors
  • Shot of Jaq » Marketing Or Madness?
  • Shot of Jaq » Web vs. Desktop
  • Shot of Jaq » The Lobbyist’s Recipe
  • Shot of Jaq » Later, Data
more
  • contact
  • about