[code.view]

[top] / python / PyMOTW / smtpd / smtpd_custom.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import smtpd
     import asyncore
     
     class CustomSMTPServer(smtpd.SMTPServer):
         
         def process_message(self, peer, mailfrom, rcpttos, data):
             print 'Receiving message from:', peer
             print 'Message addressed from:', mailfrom
             print 'Message addressed to  :', rcpttos
             print 'Message length        :', len(data)
             return
     
     server = CustomSMTPServer(('127.0.0.1', 1025), None)
     
     asyncore.loop()
     

[top] / python / PyMOTW / smtpd / smtpd_custom.py

contact | logmethods.com