Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- cat << __EOF__ | sudo python
- from smtpd import SMTPServer
- import asyncore
- import datetime
- class LoggingServer(SMTPServer):
- logName = "mail.log"
- log = None
- def __init__(self):
- SMTPServer.__init__(self, ('localhost', 25), None)
- self.log = open(self.logName, "a")
- print "[appending to '%s']" % (self.logName)
- def process_message(self, peer, mailfrom, rcpttos, data):
- today = datetime.date.today()
- print "-------------------------------------------------------------------------------"
- print "Date: %s" % (today)
- print ""
- print str(data)
- self.log.write("-------------------------------------------------------------------------------\n")
- self.log.write("Date: %s" % (today))
- self.log.write("\n")
- self.log.write("\n")
- self.log.write(str(data))
- self.log.write("\n")
- self.log.flush()
- server = LoggingServer()
- print "[waiting for email]"
- asyncore.loop()
- __EOF__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement