How to configure it to work on a developers machine
===================================================

Add a symlink to the mailpost script

  sudo ln -s /home/developer_user/src/web_app/bin/mailpost /etc/postfix/mailpost

Add an email handler to /etc/postfix/master.cf

  + fake_host_mailer  unix  -       n       n       -       -       pipe
  +  flags=FR user=(YOUR USER NAME HERE) argv=/etc/postfix/mailpost http://localhost:5000/got_mail /home/developer_user/src/web_app/instance/uploads
  +  ${nexthop} ${user}

Add a transport @fake_host -> our script in /etc/postfix/transport

  +fake_host   fake_host_mailer:

Compile transport database

  sudo postmap /etc/postfix/transport

enable the transport map in /etc/postfix/main.cf

  + transport_maps = hash:/etc/postfix/transport

Add the fake host to your relay domains and to your destinations

  + relay_domains = example.com

  mydestination = my_pc, localhost.localdomain, , localhost, fake_host
                                                             ^^^^^^^^^

Add fake_host to /etc/hosts and reload postfix

  sudo postfix reload

Send emails to some_email@fake_host

How to configure it to work on a production server
==================================================

  # Add a symlink to the mailpost script

  ln -s /srv/example.com/release/bin/mailpost /etc/postfix/mailpost

  # Add an email handler to /etc/postfix/master.cf

  + example_mailer  unix  -       n       n       -       -       pipe
  +  flags=FR user=www-data argv=/etc/postfix/mailpost http://localhost:5000/got_mail /srv/example.com/uploads
  +  ${nexthop} ${user}

  # Add a transport @example.com -> our script in /etc/postfix/transport

  +@example.com   example_mailer:

  # Compil transport database

  postmap /etc/postfix/transport

  # Add example.com to relay domains and enable the transport map to /etc/postfix/main.cf

  + transport_maps = hash:/etc/postfix/transport
  + relay_domains = example.com

  # Reload postfix

  postfix reload
