470 | | server = smtplib.SMTP(self.smtpserver) |
471 | | try : |
472 | | server.sendmail(adminmail, [touser], "From: %s\nTo: %s\n%s" % (adminmail, touser, fullmessage)) |
473 | | except smtplib.SMTPException, answer : |
474 | | for (k, v) in answer.recipients.items() : |
475 | | self.logger.log_message(_("Impossible to send mail to %s, error %s : %s") % (k, v[0], v[1]), "error") |
476 | | server.quit() |
| 474 | try : |
| 475 | server = smtplib.SMTP(self.smtpserver) |
| 476 | except socket.error, msg : |
| 477 | self.logger.log_message(_("Impossible to connect to SMTP server : %s") % msg, "error") |
| 478 | else : |
| 479 | try : |
| 480 | server.sendmail(adminmail, [touser], "From: %s\nTo: %s\n%s" % (adminmail, touser, fullmessage)) |
| 481 | except smtplib.SMTPException, answer : |
| 482 | for (k, v) in answer.recipients.items() : |
| 483 | self.logger.log_message(_("Impossible to send mail to %s, error %s : %s") % (k, v[0], v[1]), "error") |
| 484 | server.quit() |