iro/anbieter/smtp.py
changeset 58 fb161058bcab
parent 37 6e5bd561ddd0
child 68 85fc1e5dea79
equal deleted inserted replaced
57:97ef6ca145e6 58:fb161058bcab
    68 
    68 
    69     def sendMail(self,mail,recipients):   
    69     def sendMail(self,mail,recipients):   
    70         logger.debug('SMTP.sendMail(%s,%s)'%(mail,  str(recipients)))
    70         logger.debug('SMTP.sendMail(%s,%s)'%(mail,  str(recipients)))
    71         if not self.bStart:
    71         if not self.bStart:
    72             self.prepareSMTP()
    72             self.prepareSMTP()
    73 
    73        
    74         mail.content['From']=self.send_from
    74         frm=self.send_from
       
    75         
       
    76         if mail.getFrom():
       
    77             frm = mail.getFrom()
       
    78         
       
    79         mail.content['From'] = frm 
    75         
    80         
    76         while len(recipients) > 0:
    81         while len(recipients) > 0:
    77             tmp_recipients=recipients[:self.max_recipients]
    82             tmp_recipients=recipients[:self.max_recipients]
    78             mail.content['To']=", ".join(tmp_recipients)
    83             mail.content['To']=", ".join(tmp_recipients)
    79             logger.debug('self.smtp.sendmail(%s,%s,%s)'%(self.send_from,  str(tmp_recipients), mail.as_string()))
    84             logger.debug('self.smtp.sendmail(%s,%s,%s)'%(frm,  str(tmp_recipients), mail.as_string()))
    80             self.smtp.sendmail(self.send_from,  tmp_recipients, mail.as_string())
    85             self.smtp.sendmail(frm,  tmp_recipients, mail.as_string())
    81             self.updateStatus( arranged=tmp_recipients)
    86             self.updateStatus( arranged=tmp_recipients)
    82             recipients = recipients[self.max_recipients:]
    87             recipients = recipients[self.max_recipients:]
    83         
    88         
    84         self.shutdownSMTP()
    89         self.shutdownSMTP()
    85 
    90