Finding the maximum message size
This was born from a need to see how big a ZIP file I could send my accountant in Australia, and scratching the itch to write some code.
The fact that most SMTP servers talk Extended SMTP makes this relatively easy, and Python has some great modules for DNS and SMTP.
One gripe I do have is how long it takes the Python modules to mature. It's taken until Python 2.6 for smtplib.SMTP() to gain a timeout parameter, for example.
Anyway, I was able to write something nice and generic (it works for any domain) in around 100 lines, thanks in no small part to the DNS module, which makes getting a list of MX records stupidly easy.
$ ./maxmessagesize.py andrew.net.au daedalus.andrew.net.au: -1 $ ./maxmessagesize.py pollock.id.au ASPMX.L.GOOGLE.COM: 35,651,584 ALT1.ASPMX.L.GOOGLE.COM: 35,651,584 ALT2.ASPMX.L.GOOGLE.COM: 35,651,584 ASPMX2.GOOGLEMAIL.COM: 35,651,584 ASPMX3.GOOGLEMAIL.COM: 35,651,584 ASPMX4.GOOGLEMAIL.COM: 35,651,584 ASPMX5.GOOGLEMAIL.COM: 35,651,584 $ ./maxmessagesize.py debian.org master.debian.org: 104,857,600 $ ./maxmessagesize.py cameronp.com mail1.mysmarthost.com: 30,000,000 mail2.mysmarthost.com: 30,000,000 $ ./maxmessagesize.py ubuntu.com mx.canonical.com: 62,914,560 $ ./maxmessagesize.py clug.org.au mx.clug.org.au: 50,000,000 $ ./maxmessagesize.py linux.org.au morton.linux.org.au: 52,428,800
It's good to see that in most cases of domains I tried, all of the MXes had the same maximum message size.
Source code is here