Handle Exceptions in mod_mail_summary.finalize() and check if the server actually...
authorMarius Mauch <genone@gentoo.org>
Sat, 6 Oct 2007 16:30:29 +0000 (16:30 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 6 Oct 2007 16:30:29 +0000 (16:30 -0000)
svn path=/main/trunk/; revision=7984

pym/portage/elog/mod_mail_summary.py
pym/portage/mail.py

index 7410f05af326e63e4e2fb458336e2c6240b300cd..d0b2577ae056afa0462485d975e7ce8e64ebb26d 100644 (file)
@@ -4,6 +4,7 @@
 # $Id$
 
 import portage.mail, socket, os, time
+from portage.exception import PortageException
 from email.MIMEText import MIMEText as TextMessage
 
 _items = {}
@@ -48,6 +49,9 @@ def _finalize(mysettings, items):
 
        mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject,
                mybody, attachments=items.values())
-       portage.mail.send_mail(mysettings, mymessage)
+       try:
+               portage.mail.send_mail(mysettings, mymessage)
+       except PortageException, e:
+               print str(e)
 
        return
index 0c39b4cc9b3f3978e3ce9ae3dc64778c11c80d8e..cf6ebd134e116a6ae3b3353d3c6fef85aa6ae0d9 100644 (file)
@@ -74,7 +74,11 @@ def send_mail(mysettings, message):
                try:
                        if int(mymailport) > 100000:
                                myconn = smtplib.SMTP(mymailhost, int(mymailport) - 100000)
+                               myconn.ehlo()
+                               if not myconn.has_extn("STARTTLS"):
+                                       raise portage.exception.PortageException("!!! TLS support requested for logmail but not suported by server")
                                myconn.starttls()
+                               myconn.ehlo()
                        else:
                                myconn = smtplib.SMTP(mymailhost, mymailport)
                        if mymailuser != "" and mymailpasswd != "":