Changeset 2636

Show
Ignore:
Timestamp:
02/01/06 16:36:52 (19 years ago)
Author:
jerome
Message:

Now uses correct encoding for message's body. TODO : message subject, then similar code in pykota/tool.py

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r2635 r2636  
    3838import socket 
    3939import smtplib 
     40from email.MIMEText import MIMEText 
    4041 
    4142from pykota.tool import PyKotaTool, PyKotaToolError, crashed 
     
    826827                else : 
    827828                    try : 
    828                         server.sendmail(adminmail, destination, \ 
    829                           "From: %s\nTo: %s\nCc: %s\nSubject: %s\n\n%s" \ 
    830                           % (adminmail, usermail, adminmail, _("Print Quota"), fullmessage)) 
     829                        msg = MIMEText(fullmessage, _charset=self.charset) 
     830                        msg["Subject"] = _("Print Quota") # TODO : use correct encoding for Subject header 
     831                        msg["From"] = adminmail 
     832                        msg["To"] = usermail 
     833                        msg["Cc"] = adminmail 
     834                        server.sendmail(adminmail, destination, msg.as_string()) 
    831835                    except smtplib.SMTPException, answer :     
    832836                        for (k, v) in answer.recipients.items() :