Changeset 3013 for pykota/trunk/bin/pkmail
- Timestamp:
- 09/06/06 22:36:35 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkmail
r2829 r3013 30 30 import smtplib 31 31 import email 32 from email.MIMEText import MIMEText 33 from email.Header import Header 34 import email.Utils 32 35 33 36 from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ … … 96 99 97 100 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") 99 102 result = "Either you mistyped your command, or you're a bad guy !" 100 103 else : … … 104 107 105 108 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) 106 114 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()) 108 116 server.quit() 109 117 self.logdebug("Answer sent to : %s" % useremail)