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