diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-25 11:39:47 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-25 11:39:47 +0200 |
commit | 01f01abb51af0639bd0e1fccd4ad5fccd5ca074c (patch) | |
tree | aa7eb521a83be88e696bc19c79fa26eff4a3d2d3 /portato/gui/windows/mailinfo.py | |
parent | 235a2b16ef2b6e562ce31a81f9c69451d6da6a39 (diff) | |
download | portato-01f01abb51af0639bd0e1fccd4ad5fccd5ca074c.tar.gz portato-01f01abb51af0639bd0e1fccd4ad5fccd5ca074c.tar.bz2 portato-01f01abb51af0639bd0e1fccd4ad5fccd5ca074c.zip |
Added mail error message dialog
Diffstat (limited to '')
-rw-r--r-- | portato/gui/windows/mailinfo.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/portato/gui/windows/mailinfo.py b/portato/gui/windows/mailinfo.py index 8e476c6..1b5735a 100644 --- a/portato/gui/windows/mailinfo.py +++ b/portato/gui/windows/mailinfo.py @@ -12,11 +12,12 @@ from __future__ import absolute_import -import smtplib +import smtplib, socket import time from .basic import AbstractDialog from ..utils import GtkThread +from ..dialogs import mail_failure_dialog from ...helper import debug, info from ...constants import VERSION @@ -59,20 +60,23 @@ Subject: %s self.message = message def send (self): - debug("Connecting to server") - server = smtplib.SMTP("mail.necoro.eu") - debug("Sending mail") try: + debug("Connecting to server") + server = smtplib.SMTP("mail.necoro.eu") + debug("Sending mail") try: - server.sendmail(self.addr, self.TO, self.message) - except smtplib.SMTPRecipientsRefused, e: - info(_("An error occurred while sending. I think we where greylisted. The error: %s") % e) - info(_("Wait 60 seconds and try again.")) - time.sleep(60) - server.sendmail(self.addr, self.TO, self.message) - debug("Sent") - finally: - server.quit() + try: + server.sendmail(self.addr, self.TO, self.message) + except smtplib.SMTPRecipientsRefused, e: + info(_("An error occurred while sending. I think we where greylisted. The error: %s") % e) + info(_("Wait 60 seconds and try again.")) + time.sleep(60) + server.sendmail(self.addr, self.TO, self.message) + debug("Sent") + finally: + server.quit() + except socket.error, e: + mail_failure_dialog("%s (Code: %s)" % (e.args[1], e.args[0])) def cb_cancel_clicked (self, *args): |