mail muss nun mit einer mailadresse aufgerufen werden
authorSandro Knauß <knauss@netzguerilla.net>
Thu, 04 Nov 2010 21:58:59 +0100
changeset 58 fb161058bcab
parent 57 97ef6ca145e6
child 59 642098115855
mail muss nun mit einer mailadresse aufgerufen werden
iro/anbieter/content.py
iro/anbieter/smtp.py
iro/joblist.py
iro/user.py
--- a/iro/anbieter/content.py	Thu Nov 04 21:57:51 2010 +0100
+++ b/iro/anbieter/content.py	Thu Nov 04 21:58:59 2010 +0100
@@ -45,15 +45,18 @@
         return self.attachments[i]
 
 class Mail(content):
-    def __init__(self, subject, body):
+    def __init__(self, subject, body, frm):
         con=MIMEText(body.encode("utf-8"), _charset='utf-8')
         sub=Header(subject.encode('utf-8'), 'utf-8')
         con['Subject']=sub
+        self.frm=frm
         content.__init__(self, con)
-  
+
     def sendto(self,anbieter,recipients):
         anbieter.sendMail(self,recipients)
 
     def as_string(self):
         return self.content.as_string()
-        
+
+    def getFrom(self):
+        return self.frm
--- a/iro/anbieter/smtp.py	Thu Nov 04 21:57:51 2010 +0100
+++ b/iro/anbieter/smtp.py	Thu Nov 04 21:58:59 2010 +0100
@@ -70,14 +70,19 @@
         logger.debug('SMTP.sendMail(%s,%s)'%(mail,  str(recipients)))
         if not self.bStart:
             self.prepareSMTP()
-
-        mail.content['From']=self.send_from
+       
+        frm=self.send_from
+        
+        if mail.getFrom():
+            frm = mail.getFrom()
+        
+        mail.content['From'] = frm 
         
         while len(recipients) > 0:
             tmp_recipients=recipients[:self.max_recipients]
             mail.content['To']=", ".join(tmp_recipients)
-            logger.debug('self.smtp.sendmail(%s,%s,%s)'%(self.send_from,  str(tmp_recipients), mail.as_string()))
-            self.smtp.sendmail(self.send_from,  tmp_recipients, mail.as_string())
+            logger.debug('self.smtp.sendmail(%s,%s,%s)'%(frm,  str(tmp_recipients), mail.as_string()))
+            self.smtp.sendmail(frm,  tmp_recipients, mail.as_string())
             self.updateStatus( arranged=tmp_recipients)
             recipients = recipients[self.max_recipients:]
         
--- a/iro/joblist.py	Thu Nov 04 21:57:51 2010 +0100
+++ b/iro/joblist.py	Thu Nov 04 21:58:59 2010 +0100
@@ -54,11 +54,11 @@
         job=self.manager.FaxJob(self.providerlist, provider,subject, content.FAX(subject,'' ,fax),recipients)
         return self.__registerJob__(job)
 
-    def newMail(self,subject, body,recipients,provider="default"):
+    def newMail(self, subject, body, recipients, frm, provider="default"):
         '''
         creates a new Mail
         '''
-        job=self.manager.MailJob(self.providerlist, provider,subject, content.Mail(subject, body),recipients)
+        job=self.manager.MailJob(self.providerlist, provider,subject, content.Mail(subject, body, frm),recipients)
         return self.__registerJob__(job) 
 
     def _createID(self):
--- a/iro/user.py	Thu Nov 04 21:57:51 2010 +0100
+++ b/iro/user.py	Thu Nov 04 21:58:59 2010 +0100
@@ -100,10 +100,10 @@
 
     
         
-    def startMail(self,subject,  body , recipients,provider="default"):
+    def startMail(self, subject,  body, recipients, frm, provider="default"):
         if not "mail" in self.features:
             raise NotSupportedFeature("mail")
-        id = self.jobqueue.newMail(subject,  body ,recipients,provider)
+        id = self.jobqueue.newMail(subject, body, recipients, frm,  provider)
         self.jobs[id]=self.jobqueue[id]
         return id