Configure postfix for local delivery only

To configure postfix so that it sends emails to the local machine but rejects those sent to external domains, add the following to /etc/postfix/main.cf:

inet_interfaces = loopback-only
mynetworks_style = host
default_transport = error: Local delivery only!

When attempting to send an email to an external domain, you should see a rejected messages in the logs, similar to the following:

Sep 14 16:16:37 slap postfix/pickup[13599]: C4E3B744DDA: uid=1000 from=<steph>
Sep 14 16:16:37 slap postfix/cleanup[13650]: C4E3B744DDA: message-id=<20080914151637.GA13645@slap>
Sep 14 16:16:37 slap postfix/qmgr[13596]: C4E3B744DDA: from=<steph@slap.localdomain>, size=386, nrcpt=1 (queue active)
Sep 14 16:16:37 slap postfix/error[13652]: C4E3B744DDA: to=<test@example.com>, relay=none, delay=0.11, delays=0.09/0/0/0.02, dsn=5.0.0, status=bounced (Local delivery only!)
Sep 14 16:16:37 slap postfix/cleanup[13650]: CF18C744DDC: message-id=<20080914151637.CF18C744DDC@slap.localdomain>
Sep 14 16:16:37 slap postfix/qmgr[13596]: CF18C744DDC: from=<>, size=2078, nrcpt=1 (queue active)
Sep 14 16:16:37 slap postfix/bounce[13653]: C4E3B744DDA: sender non-delivery notification: CF18C744DDC
Sep 14 16:16:37 slap postfix/qmgr[13596]: C4E3B744DDA: removed
Sep 14 16:16:38 slap postfix/local[13654]: CF18C744DDC: to=<steph@slap.localdomain>, relay=local, delay=0.39, delays=0.02/0/0/0.37, dsn=2.0.0, status=sent (delivered to maildir)
Sep 14 16:16:38 slap postfix/qmgr[13596]: CF18C744DDC: removed

References

Last modified: 14/09/2008 Tags:

Related Pages

Other pages possibly of interest:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top