Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a postfix setup for my web server and I want to store every outgoing email from the server to a database. Does any one know how I can achieve this. FYI I just use this server to send emails and I use google Apps to receive emails.

share|improve this question

migrated from Feb 5 '12 at 0:20

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

Youre going to have to do several things

  1. Use the always_bcc setting to fork a copy of the emails to an alternate destination (what you use really doesnt matter, this is just for item #3 below)
  2. Set up a pipe transport in your file which will receive the emails and store them in the database. You are going to have to write this utility/script yourself.
  3. Use transport_maps to redirect mail for that always_bcc address to the transport you defined in
share|improve this answer

Your Answer


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.