Permalink
Browse files

fixing so that batch email smtp clients get closed after batch emails

  • Loading branch information...
1 parent e5996b4 commit fcfa05dbc4a76a6be4b2da4c69de8d9baf4fc59b @swarbhanu swarbhanu committed Dec 5, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 ion/services/dm/presentation/user_notification_service.py
@@ -123,7 +123,6 @@ def on_start(self):
self.event_repo = self.container.instance.event_repository
- self.smtp_client = setting_up_smtp_client()
self.ION_NOTIFICATION_EMAIL_ADDRESS = 'data_alerts@oceanobservatories.org'
@@ -747,10 +746,14 @@ def format_and_send_email(self, events_for_message, user_id):
msg_subject = "(SysName: " + get_sys_name() + ") ION event "
+ smtp_client = setting_up_smtp_client()
+
self.send_batch_email( msg_body = msg_body,
msg_subject = msg_subject,
msg_recipient=self.user_info[user_id]['user_contact'].email,
- smtp_client=self.smtp_client )
+ smtp_client=smtp_client )
+
+ smtp_client.quit()
def send_batch_email(self, msg_body, msg_subject, msg_recipient, smtp_client):
"""

0 comments on commit fcfa05d

Please sign in to comment.