bodewig     2004/03/03 08:24:49

  Modified:    python/gump/net mailer.py
  Log:
  Initial support for encoding of From and Subject headers - in the hope
  to bring the log4j-test failures to Ceki's attention on the next run.
  
  Certainly incomplete as iso-8859-1 is hardcoded and all that.
  
  Revision  Changes    Path
  1.7       +9 -8      gump/python/gump/net/mailer.py
  
  Index: mailer.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/net/mailer.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mailer.py 13 Feb 2004 22:12:37 -0000      1.6
  +++ mailer.py 3 Mar 2004 16:24:48 -0000       1.7
  @@ -64,6 +64,7 @@
   from gump import log
   from gump.config import *
   from gump.utils import *
  +from email.Header import Header
   
   import smtplib, string
           
  @@ -80,9 +81,9 @@
        # The subject
       # The text of the message (the main bodypart)
       def __init__(self,toaddrs,fromaddr,subject,text,signature=None):
  -        self.toaddrs=toaddrs
  -        self.fromaddr=fromaddr
  -        self.subject=subject
  +        self.toaddrs = toaddrs
  +        self.fromaddr = Header(fromaddr, 'iso-8859-1')
  +        self.subject = Header(subject, 'iso-8859-1')
           self.text=text
                
                # The signature
  @@ -100,9 +101,9 @@
           # Add the From: and To: headers at the start!
           data = ("Date: %s\r\nFrom: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s%s"
                % (     time.strftime('%d %b %y %H:%M:%S', time.gmtime()),
  -                 self.fromaddr, 
  +                 self.fromaddr.encode(), 
                        string.join(self.toaddrs, ", "),
  -                self.subject,
  +                self.subject.encode(),
                        self.text,
                        default.signature))
                        
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to