On Tue, 14 Sep 2004 17:45:25 -0500, Chad Walstrom <chewie at wookimus.net> wrote:
> Ben Bargabus wrote:
> > Is there a way (or program/script I can run) to verify that incoming
> > messages come from valid email addys and bounce those that don't?  I
> > know that the from header can easily be forged but I at least want to
> > verify that the forged header is a legit user name on that server.
> > Just looking for another way to cut down on sp at m here.  By the way, I
> > run sendmail and procmail if that matters.  Ben.
> 
> Define valid email address... RFC822 valid?  Are you asking to use VRFY
> on an SMTP server?  You could write up a python or perl script to submit
> VRFY requests for the email in question.  That will involve an MX lookup
> for the mail host.  Remember, you can only really use VRFY on primary
> mail hosts rather than the backup MX hosts (which simply spool stuff).
> 
> http://www.python.org/doc/2.3.4/lib/module-smtplib.html
> http://www.python.org/doc/2.3.4/lib/module-email.html
> 
> Don't exactly know how to get the DNS record just yet.  You might be
> able to rip something from Twisted or pynms.sf.net.  You could run 'dig
> host.domain.tld MX' and parse the output for the primary as well.

You can use adns-python for this. It works well, and is very fast.

http://dustman.net/andy/python/adns-python

The adns module provides an interface to the GNU adns asynchronous DNS
resolver library. Asynchronous is always the way to go with networking
:)

-Josh

_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
Help beta test TCLUG's potential new home: http://plone.mn-linux.org
Got pictures for TCLUG? Beta test http://plone.mn-linux.org/gallery
tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list