12 import smtplib |
12 import smtplib |
13 import socket |
13 import socket |
14 |
14 |
15 from PyQt4.QtCore import * |
15 from PyQt4.QtCore import * |
16 from PyQt4.QtGui import * |
16 from PyQt4.QtGui import * |
|
17 |
|
18 from E5Gui import E5MessageBox |
17 |
19 |
18 from .Ui_EmailDialog import Ui_EmailDialog |
20 from .Ui_EmailDialog import Ui_EmailDialog |
19 |
21 |
20 from .Info import BugAddress, FeatureAddress |
22 from .Info import BugAddress, FeatureAddress |
21 import Preferences |
23 import Preferences |
286 return False |
288 return False |
287 try: |
289 try: |
288 server.login(Preferences.getUser("MailServerUser"), |
290 server.login(Preferences.getUser("MailServerUser"), |
289 password) |
291 password) |
290 except (smtplib.SMTPException, socket.error) as e: |
292 except (smtplib.SMTPException, socket.error) as e: |
291 res = QMessageBox.critical(self, |
293 res = E5MessageBox.critical(self, |
292 self.trUtf8("Send bug report"), |
294 self.trUtf8("Send bug report"), |
293 self.trUtf8("""<p>Authentication failed.<br>Reason: {0}</p>""") |
295 self.trUtf8("""<p>Authentication failed.<br>Reason: {0}</p>""") |
294 .format(str(e)), |
296 .format(str(e)), |
295 QMessageBox.StandardButtons(\ |
297 QMessageBox.StandardButtons(\ |
296 QMessageBox.Abort | \ |
298 QMessageBox.Abort | \ |
306 server.sendmail(Preferences.getUser("Email"), self.__toAddress, msg) |
308 server.sendmail(Preferences.getUser("Email"), self.__toAddress, msg) |
307 server.quit() |
309 server.quit() |
308 QApplication.restoreOverrideCursor() |
310 QApplication.restoreOverrideCursor() |
309 except (smtplib.SMTPException, socket.error) as e: |
311 except (smtplib.SMTPException, socket.error) as e: |
310 QApplication.restoreOverrideCursor() |
312 QApplication.restoreOverrideCursor() |
311 res = QMessageBox.critical(self, |
313 res = E5MessageBox.critical(self, |
312 self.trUtf8("Send bug report"), |
314 self.trUtf8("Send bug report"), |
313 self.trUtf8("""<p>Message could not be sent.<br>Reason: {0}</p>""") |
315 self.trUtf8("""<p>Message could not be sent.<br>Reason: {0}</p>""") |
314 .format(str(e)), |
316 .format(str(e)), |
315 QMessageBox.StandardButtons(\ |
317 QMessageBox.StandardButtons(\ |
316 QMessageBox.Abort | \ |
318 QMessageBox.Abort | \ |