Changeset 3013

Show
Ignore:
Timestamp:
09/06/06 22:36:35 (18 years ago)
Author:
jerome
Message:

Killed another item from the TODO list

Location:
pykota/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r3012 r3013  
    4242from email.MIMEText import MIMEText 
    4343from email.Header import Header 
     44import email.Utils 
    4445 
    4546from mx import DateTime 
     
    10371038                        else :     
    10381039                            msg["To"] = adminmail 
     1040                        msg["Date"] = email.Utils.formatdate(localtime=True) 
    10391041                        server.sendmail(adminmail, destination, msg.as_string()) 
    10401042                    except smtplib.SMTPException, answer :     
  • pykota/trunk/bin/pkmail

    r2829 r3013  
    3030import smtplib 
    3131import email 
     32from email.MIMEText import MIMEText 
     33from email.Header import Header 
     34import email.Utils 
    3235 
    3336from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 
     
    9699             
    97100        if cheatmeonce :     
    98             self.logdebug("Possible intruder at %s : %s" % (useremail, str(arguments))) 
     101            self.printInfo("Possible intruder at %s : %s" % (useremail, str(arguments)), "warn") 
    99102            result = "Either you mistyped your command, or you're a bad guy !" 
    100103        else : 
     
    104107         
    105108        self.logdebug("Sending answer to : %s" % useremail) 
     109        emailmsg = MIMEText(result, _charset=self.charset) 
     110        emailmsg["Subject"] = str(Header(_("Result of your commands"), charset=self.charset)) 
     111        emailmsg["From"] = whoami 
     112        emailmsg["To"] = useremail 
     113        emailmsg["Date"] = email.Utils.formatdate(localtime=True) 
    106114        server = smtplib.SMTP(self.smtpserver) 
    107         server.sendmail(whoami, [ useremail ], "From: %s\nTo: %s\nSubject: Result of your commands\n\n%s\n" % (whoami, useremail, result)) 
     115        server.sendmail(whoami, [ useremail ], emailmsg.as_string()) 
    108116        server.quit() 
    109117        self.logdebug("Answer sent to : %s" % useremail) 
  • pykota/trunk/pykota/tool.py

    r3006 r3013  
    3535from email.MIMEText import MIMEText 
    3636from email.Header import Header 
     37import email.Utils 
    3738 
    3839from mx import DateTime 
     
    360361                msg["To"] = crashrecipient 
    361362                msg["Cc"] = admin 
     363                msg["Date"] = email.Utils.formatdate(localtime=True) 
    362364                server.sendmail(admin, [admin, crashrecipient], msg.as_string()) 
    363365                server.quit() 
     
    495497        msg["From"] = adminmail 
    496498        msg["To"] = usermail 
     499        msg["Date"] = email.Utils.formatdate(localtime=True) 
    497500        self.sendMessage(adminmail, usermail, msg.as_string()) 
    498501         
  • pykota/trunk/TODO

    r3012 r3013  
    2121 
    2222TODO, in no particular order : 
    23          
    24         - Add a date header to all email messages sent, because some 
    25           spam detection tools cause SMTP servers to reject the  
    26           messages with no date. 
    2723         
    2824        - Allow the disabling of an user print quota entry without