> From: John Jetmore [
mailto:jj33@pobox.com]
> Sent: Wednesday, August 11, 2010 8:55 AM
>
> Check out
> http://lists.exim.org/lurker/message/20030514.203046.6b05039f.en.html.
> I once wrote a quick script to do this for the fun of it. You might
> have some additional issues w/ TLS, but the basics are there.
Thanks. I rewrote it in python because I had some trouble getting SSL to
work in perl. But as you said, the basics were there, and it was pretty
simple. Here's my version:
#!/usr/local/bin/python2.6
import sys
from smtplib import SMTP
try:
# "timeout" only available in python 2.6
server = SMTP('smtp.gmail.com',587,timeout=10)
server.ehlo(sys.argv[1])
server.starttls()
server.ehlo(sys.argv[1]) # say hello again
# server.login raises an exception if authentication failure.
server.login(sys.argv[1], sys.argv[2])
server.quit()
result=0
except:
result=1
sys.exit(result)