how to send a form html by email ?

Gerard Breiner gerard.breiner at
Mon Mar 17 12:48:51 CET 2003

My form is a html form. My server apache is configured with mod-python and
here is a part of my http.conf :
Alias /python "C:/Program Files/Apache Group/Apache/htdocs/python"
     <Directory "C:/Program Files/Apache Group/Apache/htdocs/python">
  AddHandler python-program .py
  PythonHandler email
  PythonDebug on
and here is my file that i am trying to test.
import smtplib

# Import the email modules we'll need
from email.MIMEText import MIMEText

# Open a plain text file for reading.  For this example, assume that
# the text file contains only ASCII characters.
fp = open(textfile, 'rb')
# Create a text/plain message
msg = MIMEText(

# me == the sender's email address
# you == the recipient's email address
msg['Subject'] = 'The contents of %s' % textfile
msg['From'] = me
msg['To'] = you

# Send the message via our own SMTP server, but don't include the
# envelope header.
s = smtplib.SMTP()
s.sendmail(me, [you], msg.as_string())

Here is the error from my navigator :
Mod_python error: "PythonHandler email"

Traceback (most recent call last):

  File "C:\Python22\Lib\mod_python\", line 181, in Dispatch
    module = import_module(module_name, _req)

  File "C:\Python22\Lib\mod_python\", line 335, in import_module
    module = imp.load_module(mname, f, p, d)

  File "c:/program files/apache group/apache/htdocs/python\", line
2, in ?

ImportError: No module named MIMEText
Maybe, this module isn't implemented in apache module ?

Best regards


"Gerhard Häring" <gerhard.haering at> a écrit dans le message de
news: slrnb7ba24.1fo.gerhard.haering at
> Gerard Breiner <gerard.breiner at> wrote:
> > Hello,
> >
> > Is someone has already made a script python so that to send a form by
> > email from the web server ? [...]
> You can send email using the smtplib module. I'm not sure what kind of
> "form" you might want to send by email, though.
> -- Gerhard

More information about the Python-list mailing list