63 self.smtp.login(self.user,self.pw) |
65 self.smtp.login(self.user,self.pw) |
64 |
66 |
65 self.bStart=True |
67 self.bStart=True |
66 |
68 |
67 def sendMail(self,mail,recipients): |
69 def sendMail(self,mail,recipients): |
68 import logging |
70 logger.debug('SMTP.sendMail(%s,%s)'%(mail, str(recipients))) |
69 logging.debug('SMTP.sendMail(%s,%s)'%(mail, str(recipients))) |
|
70 if not self.bStart: |
71 if not self.bStart: |
71 self.prepareSMTP() |
72 self.prepareSMTP() |
72 |
73 |
73 mail.content['From']=self.send_from |
74 mail.content['From']=self.send_from |
74 |
75 |
75 while len(recipients) > 0: |
76 while len(recipients) > 0: |
76 tmp_recipients=recipients[:self.max_recipients] |
77 tmp_recipients=recipients[:self.max_recipients] |
77 mail.content['To']=", ".join(tmp_recipients) |
78 mail.content['To']=", ".join(tmp_recipients) |
78 logging.debug('self.smtp.sendmail(%s,%s,%s)'%(self.send_from, str(tmp_recipients), mail.as_string())) |
79 logger.debug('self.smtp.sendmail(%s,%s,%s)'%(self.send_from, str(tmp_recipients), mail.as_string())) |
79 self.smtp.sendmail(self.send_from, tmp_recipients, mail.as_string()) |
80 self.smtp.sendmail(self.send_from, tmp_recipients, mail.as_string()) |
80 self.updateStatus( arranged=tmp_recipients) |
81 self.updateStatus( arranged=tmp_recipients) |
81 recipients = recipients[self.max_recipients:] |
82 recipients = recipients[self.max_recipients:] |
82 |
83 |
83 self.shutdownSMTP() |
84 self.shutdownSMTP() |