[Mimedefang] Bounce if its not for a local user.

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Thu Apr 22 12:43:20 EDT 2004


> From: Larry Guest [mailto:larry at opsource.net]
> I would like to filter mail and bounce anything that is not 
> for a local user.  
> I assume I will have to setup a file on the server and list all the
> valid users in this file.  There are only about 50 at the most so this
> is not a problem.
> 
> Any ideas?

Are the users local to the server?  Or are you using the server as a relay?

If the former, sendmail should already be doing this for you.

If the latter, there are two options:
You can use a mimedefang function check_against_smtp_server() to see if the
user exists on the remote server.  This works for *most* remote servers.

If you're using an Exchange server, life is a little more complicated.  (I
know, I'm doing exactly this.)  However, all hope is not lost.

You can create a Perl script to run LDAP queries against your Exchange
server every (say) fifteen minutes.  The LDAP query can extract all valid
email addresses.  Then the Perl script should make a sendmail "access" file
and hash it to access.db

See
http://lists.roaringpenguin.com/pipermail/mimedefang/2003-December/018633.ht
ml for how to do it against an Exchange 2000 server
It's also possible to do against an Exchange 5.5 server - I'm doing this
(email me offlist for my script)


This method has a drawback.  Email to new addresses will be bounced until
the Perl script has had a chance to run.  So, if you create a new Exchange
user, they won't be able to get email from the outside for up to fifteen
minutes.  In my experience, this is not a big problem at all.

Matthew.van.Eerde at hbinc.com                805.964.4554 x902
Hispanic Business Inc./HireDiversity.com   Software Engineer
perl -e"print join er,reverse',','l hack',' P','Just anoth'"



More information about the MIMEDefang mailing list