Changeset 3013 for pykota/trunk/bin

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/bin
Files:
2 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)