I would love for anybody to comment on this code with regard to redundancy/efficiency/wordiness or whatever else. for instance, do i understand correctly that i cant have a try: else: without an intervening except:? -dave
stdout.write("calling smtp server...") try: server = SMTP(msgsmtp) except: stdout.write("FAIL.") #using .write to avoid the implied \n with print else: server.set_debuglevel(msgdebug) stdout.write("starting tls...") server.ehlo(msgfrom) try: server.starttls() except: stdout.write("FAIL.") else: server.ehlo(msgfrom) #neessary duplication (?) stdout.write("logging in...") try: server.login(msgfrom, msgpass) except: stdout.write("FAIL.") else: stdout.write("sending...") try: server.sendmail(msgfrom, msgto, msgtxt + "\n.\n") except: stdout.write("FAIL.") else: try: server.quit() except sslerror: # a known and largely ignored issue with early EOF in ssl protocol stdout.write("success.") else: stdout.write("success.") -- http://mail.python.org/mailman/listinfo/python-list