Index: /pykota/trunk/pykota/tool.py
===================================================================
--- /pykota/trunk/pykota/tool.py (revision 2793)
+++ /pykota/trunk/pykota/tool.py (revision 2795)
@@ -313,7 +313,11 @@
                 admin = self.config.getAdminMail("global") # Nice trick, isn't it ?
                 server = smtplib.SMTP(self.smtpserver)
-                server.sendmail(admin, [admin, crashrecipient], \
-                                       "From: %s\nTo: %s\nCc: %s\nSubject: PyKota v%s crash traceback !\n\n%s" % \
-                                       (admin, crashrecipient, admin, __version__, fullmessage))
+                msg = MIMEText(fullmessage, _charset=self.charset)
+                msg["Subject"] = str(Header("PyKota v%s crash traceback !" \
+                                        % __version__, charset=self.charset))
+                msg["From"] = admin
+                msg["To"] = crashrecipient
+                msg["Cc"] = admin
+                server.sendmail(admin, [admin, crashrecipient], msg.as_string())
                 server.quit()
         except :
@@ -428,6 +432,4 @@
     def sendMessage(self, adminmail, touser, fullmessage) :
         """Sends an email message containing headers to some user."""
-        if "@" not in touser :
-            touser = "%s@%s" % (touser, self.maildomain or self.smtpserver)
         try :    
             server = smtplib.SMTP(self.smtpserver)
@@ -436,5 +438,5 @@
         else :
             try :
-                server.sendmail(adminmail, [touser], "From: %s\nTo: %s\n%s" % (adminmail, touser, fullmessage))
+                server.sendmail(adminmail, [touser], fullmessage)
             except smtplib.SMTPException, answer :    
                 for (k, v) in answer.recipients.items() :
@@ -445,9 +447,22 @@
         """Sends an email message to a user."""
         message += _("\n\nPlease contact your system administrator :\n\n\t%s - <%s>\n") % (admin, adminmail)
-        self.sendMessage(adminmail, user.Email or user.Name, "Subject: %s\n\n%s" % (subject, message))
+        usermail = user.Email or user.Name
+        if "@" not in usermail :
+            usermail = "%s@%s" % (usermail, self.maildomain or self.smtpserver or "localhost")
+        msg = MIMEText(message, _charset=self.charset)
+        msg["Subject"] = str(Header(subject, charset=self.charset))
+        msg["From"] = adminmail
+        msg["To"] = usermail
+        self.sendMessage(adminmail, usermail, msg.as_string())
         
     def sendMessageToAdmin(self, adminmail, subject, message) :
         """Sends an email message to the Print Quota administrator."""
-        self.sendMessage(adminmail, adminmail, "Subject: %s\n\n%s" % (subject, message))
+        if "@" not in adminmail :
+            adminmail = "%s@%s" % (adminmail, self.maildomain or self.smtpserver or "localhost")
+        msg = MIMEText(message, _charset=self.charset)
+        msg["Subject"] = str(Header(subject, charset=self.charset))
+        msg["From"] = adminmail
+        msg["To"] = adminmail
+        self.sendMessage(adminmail, adminmail, msg.as_string())
         
     def _checkUserPQuota(self, userpquota) :            
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 2791)
+++ /pykota/trunk/pykota/version.py (revision 2795)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.24alpha17_unofficial"
+__version__ = "1.24alpha18_unofficial"
 
 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS."
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 2791)
+++ /pykota/trunk/NEWS (revision 2795)
@@ -22,4 +22,9 @@
 PyKota NEWS :
        
+    - 1.24alpha18 (2006-03-15) :
+    
+        - Now uses MIME encapsulation for email messages to avoid
+          some problems with 8 bits messages being rejected.
+          
     - 1.24alpha17 (2006-03-06) :
     
