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

Killed another item from the TODO list

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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)