Simple Python script as SMTP server for outgoing e-mails?

Michael Torrie torriem at gmail.com
Mon Jul 22 16:21:02 CEST 2013


On 07/22/2013 06:19 AM, Gilles wrote:
> On Sun, 21 Jul 2013 21:01:09 +0000 (UTC), Grant Edwards
> <invalid at invalid.invalid> wrote:
>> Unless you've got a static IP address, a domain name, and a valid MX
>> record that will match up when they do a reverse DNS lookup, it's
>> pretty unlikely that you're going to have much luck running an SMTP
>> server.  Most other SMTP servers are probably going to ignore or
>> reject your attempts to transfer mail from your own SMTP server.
> 
> Incidently, how do ISP MTAs find whether the remote MTA is legit or
> running on some regular user's computer?
> 
> 1. Query Reverse DNS for IP
> 2. Find domain
> 3. Query DNS for MX
> 4. ?

My mail server did a number of things:
1. ensure IP address of sending server has a reverse name (domain didn't
particularly matter)
2. ensure the HELO address in SMTP matches IP address of sending server
3. check sender IP address against spam blacklists, which includes
netblocks of home ISPs, some entire countries, flagged subnets
4. greylist sender IP if the recipient requested it.  First connection
always fails with a nonfatal server error, next connection must wait at
least 5 minutes.  If a reconnection happened too quickly, the IP was
temporarily black listed.  After success, IP address is whitelisted for
a time.  A commandline MTA will not be able to get through greylisting;
only a mail server with queuing could.  Spambots tend to give up on the
first error, even now. Cheaper targets I guess.
5. spamassassin checked SPF (DNS) and domainkeys (message itself) and
weighted the spam factor accordingly

I think there were other basic rules that sendmail applied to the
sender, but I can't remember all of what they are.  This is well and
truly off topic now for the python list, though.




More information about the Python-list mailing list