diff options
author | Liutauras Adomaitis <adomaitis@kolabsys.com> | 2018-05-25 09:06:39 +0300 |
---|---|---|
committer | Liutauras Adomaitis <adomaitis@kolabsys.com> | 2018-06-04 14:04:14 +0300 |
commit | 46f61ab9984e23332477d39edbf303291e04d2ca (patch) | |
tree | 4e6c59e3c2d817550a9704acdfc6f86a142ebd7b | |
parent | 4986d1839643d9ba80fbe23c4ac8b40b0cbeef6d (diff) | |
download | pykolab-46f61ab9984e23332477d39edbf303291e04d2ca.tar.gz |
Fix D577 patch bug - modules._sendmail result assign to variable, which is used to log the result of email sending.
Summary: Define success variable to hold the _sendmail result.
Test Plan: none
Reviewers: vanmeeuwen, machniak
Reviewed By: machniak
Subscribers: petersen
Differential Revision: https://git.kolab.org/D581
-rw-r--r-- | wallace/module_invitationpolicy.py | 6 | ||||
-rw-r--r-- | wallace/module_resources.py | 13 |
2 files changed, 3 insertions, 16 deletions
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py index 17dc71c..602326d 100644 --- a/wallace/module_invitationpolicy.py +++ b/wallace/module_invitationpolicy.py @@ -1161,7 +1161,6 @@ def send_update_notification(object, receiving_user, old=None, reply=True, sende """ global auth - import smtplib from email.MIMEText import MIMEText from email.Utils import formatdate from email.header import Header @@ -1284,14 +1283,13 @@ def send_update_notification(object, receiving_user, old=None, reply=True, sende msg['From'] = Header(utils.str2unicode('%s' % orgname) if orgname else '') msg['From'].append("<%s>" % orgemail) - modules._sendmail(orgemail, receiving_user['mail'], msg.as_string()) + success = modules._sendmail(orgemail, receiving_user['mail'], msg.as_string()) log.debug(_("Sent update notification to %r: %r") % (receiving_user['mail'], success), level=8) def send_cancel_notification(object, receiving_user, deleted=False, sender=None, comment=None): """ Send a notification about event/task cancellation """ - import smtplib from email.MIMEText import MIMEText from email.Utils import formatdate from email.header import Header @@ -1346,7 +1344,7 @@ def send_cancel_notification(object, receiving_user, deleted=False, sender=None, msg['From'] = Header(utils.str2unicode('%s' % orgname) if orgname else '') msg['From'].append("<%s>" % orgemail) - modules._sendmail(orgemail, receiving_user['mail'], msg.as_string()) + success = modules._sendmail(orgemail, receiving_user['mail'], msg.as_string()) log.debug(_("Sent cancel notification to %r: %r") % (receiving_user['mail'], success), level=8) def is_auto_reply(user, sender_email, type): diff --git a/wallace/module_resources.py b/wallace/module_resources.py index c216276..f5f8382 100644 --- a/wallace/module_resources.py +++ b/wallace/module_resources.py @@ -1312,7 +1312,6 @@ def send_owner_notification(resource, owner, itip_event, success=True): """ Send a reservation notification to the resource owner """ - import smtplib from pykolab import utils from email.MIMEText import MIMEText from email.Utils import formatdate @@ -1356,17 +1355,7 @@ def send_owner_notification(resource, owner, itip_event, success=True): resource['cn'], participant_status_label(status) if success else _('failed') )) - smtp = smtplib.SMTP("localhost", 10027) - - if conf.debuglevel > 8: - smtp.set_debuglevel(True) - - try: - smtp.sendmail(resource['mail'], owner['mail'], msg.as_string()) - except Exception, e: - log.error(_("SMTP sendmail error: %r") % (e)) - - smtp.quit() + modules._sendmail(resource['mail'], owner['mail'], msg.as_string()) def owner_notification_text(resource, owner, event, success): organizer = event.get_organizer() |