Get Concurrent Relay Recipients

This perl script will pull all users’ SMTP addresses from your Active Directory (including primary and secondary email addresses) and list them in the format “ OK” which Postfix uses with relay_recipient_maps. It will also automatically create a mynetworks file, transport file, and relay_domains file to ensure all information is properly included.

UPDATE: This files have moved to my Codaset account. They are available here.

To run this scrpit, simply put it in cron and run it. Ensure that postfix is reloaded so all changes made to the postfix configuration files take effect. The cron entry should look as follows:

# /usr/local/bin/ && postfix reload && /etc/init.d/amavis restart

Some features of this program are that all LDAP queries run in parallel using a forking model. This means that you can set up as many servers as you want and it will run the queries in a parallel fashion to complete the requests in as timely a manner as possible. The script creates a relay_recipients file, a transport file, a relay_domains file, and a my networks file.

Their associated entries in /etc/postfix/ should look as follows:

mynetworks = pcre:/etc/postfix/mynetworks
relay_domains = pcre:/etc/postfix/relay_domains
relay_recipient_maps = pcre:/etc/postfix/relay_recipients
smtpd_recipient_restrictions = ... check_recipient_access pcre:/etc/postfix/relay_recipients ...
transport_maps = pcre:/etc/postfix/transport

If you have any questions/comments/concerns/feedback (all of which are appreciated), get in contact with me.

Links: This program is listed on the Postfix Wiki.

Follow My Travels

Buy My Book


  • 2020
  • 2019
  • 2017
  • 2014
  • 2013
  • 2012
  • 2011
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006

New Posts By Email