SMTP receive as well as send

Thomas Heller thomas.heller at ion-tof.com
Tue Oct 17 03:42:58 EDT 2000


> I have a minimal RFC 821 smtp server built on top of
> asyncore/asynchat, which I've used to experiment with and debug GNU
> Mailman.  It will probably make it into Python 2.1's standard library.
> In the meantime, you can download it from
> 
>     http://www.wooz.org/barry/software/pyware.html
> 
> It supports configurable backends via subclassing, but currently
> doesn't do mailbox delivery.
> 
> Enjoy,
> -Barry
This little patch allows to run it under windows (with the -n option):

*** smtpd_orig.py Tue Oct 17 07:38:47 2000
--- smtpd.py Tue Oct 17 07:42:20 2000
***************
*** 68,74 ****
  
  import sys
  import os
- import pwd
  import errno
  import getopt
  import time
--- 68,73 ----
***************
*** 507,512 ****
--- 506,517 ----
      options = parseargs()
      # Become nobody
      if options.setuid:
+         try:
+             import pwd
+         except ImportError:
+             print >> sys.stderr, \
+                   'Cannot import module "pwd"; try running with -n option.'
+             sys.exit(1)
          nobody = pwd.getpwnam('nobody')[2]
          try:
              os.setuid(nobody)

Thomas




More information about the Python-list mailing list