Changeset 2795
- Timestamp:
- 03/15/06 08:01:21 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/NEWS
r2791 r2795 22 22 PyKota NEWS : 23 23 24 - 1.24alpha18 (2006-03-15) : 25 26 - Now uses MIME encapsulation for email messages to avoid 27 some problems with 8 bits messages being rejected. 28 24 29 - 1.24alpha17 (2006-03-06) : 25 30 -
pykota/trunk/pykota/tool.py
r2793 r2795 313 313 admin = self.config.getAdminMail("global") # Nice trick, isn't it ? 314 314 server = smtplib.SMTP(self.smtpserver) 315 server.sendmail(admin, [admin, crashrecipient], \ 316 "From: %s\nTo: %s\nCc: %s\nSubject: PyKota v%s crash traceback !\n\n%s" % \ 317 (admin, crashrecipient, admin, __version__, fullmessage)) 315 msg = MIMEText(fullmessage, _charset=self.charset) 316 msg["Subject"] = str(Header("PyKota v%s crash traceback !" \ 317 % __version__, charset=self.charset)) 318 msg["From"] = admin 319 msg["To"] = crashrecipient 320 msg["Cc"] = admin 321 server.sendmail(admin, [admin, crashrecipient], msg.as_string()) 318 322 server.quit() 319 323 except : … … 428 432 def sendMessage(self, adminmail, touser, fullmessage) : 429 433 """Sends an email message containing headers to some user.""" 430 if "@" not in touser :431 touser = "%s@%s" % (touser, self.maildomain or self.smtpserver)432 434 try : 433 435 server = smtplib.SMTP(self.smtpserver) … … 436 438 else : 437 439 try : 438 server.sendmail(adminmail, [touser], "From: %s\nTo: %s\n%s" % (adminmail, touser, fullmessage))440 server.sendmail(adminmail, [touser], fullmessage) 439 441 except smtplib.SMTPException, answer : 440 442 for (k, v) in answer.recipients.items() : … … 445 447 """Sends an email message to a user.""" 446 448 message += _("\n\nPlease contact your system administrator :\n\n\t%s - <%s>\n") % (admin, adminmail) 447 self.sendMessage(adminmail, user.Email or user.Name, "Subject: %s\n\n%s" % (subject, message)) 449 usermail = user.Email or user.Name 450 if "@" not in usermail : 451 usermail = "%s@%s" % (usermail, self.maildomain or self.smtpserver or "localhost") 452 msg = MIMEText(message, _charset=self.charset) 453 msg["Subject"] = str(Header(subject, charset=self.charset)) 454 msg["From"] = adminmail 455 msg["To"] = usermail 456 self.sendMessage(adminmail, usermail, msg.as_string()) 448 457 449 458 def sendMessageToAdmin(self, adminmail, subject, message) : 450 459 """Sends an email message to the Print Quota administrator.""" 451 self.sendMessage(adminmail, adminmail, "Subject: %s\n\n%s" % (subject, message)) 460 if "@" not in adminmail : 461 adminmail = "%s@%s" % (adminmail, self.maildomain or self.smtpserver or "localhost") 462 msg = MIMEText(message, _charset=self.charset) 463 msg["Subject"] = str(Header(subject, charset=self.charset)) 464 msg["From"] = adminmail 465 msg["To"] = adminmail 466 self.sendMessage(adminmail, adminmail, msg.as_string()) 452 467 453 468 def _checkUserPQuota(self, userpquota) : -
pykota/trunk/pykota/version.py
r2791 r2795 22 22 # 23 23 24 __version__ = "1.24alpha1 7_unofficial"24 __version__ = "1.24alpha18_unofficial" 25 25 26 26 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS."