Email Script

Victor Subervi victorsubervi at
Tue Mar 2 16:48:19 CET 2010

I have the following code:

def my_mail():
  user, passwd, db, host = login()
  database = MySQLdb.connect(host, user, passwd, db)
  cursor= database.cursor()
  ourEmail1 = 'marilyn at'
  ourEmail1 = 'phil at'
  ourEmail2 = 'benoismyname at'
  form = cgi.FieldStorage()
  name = form.getfirst('name', '')
  email = form.getfirst('from', '')
  message = form.getfirst('message', '')
  message = 'Name: %s\nMessage: %s' % (name, message)
  subject = 'Message from Web Site'
      from_address = email,
      to_address = ourEmail1,
      subject = subject,
      message = message
      from_address = email,
      to_address = ourEmail2,
      subject = subject,
      message = message
  print 'Thank you, %s, we will get back to you shortly!<br />' % (name)

This sends only the first of the two emails. Why doesn't it work to send the
second? What do?

The Logos has come to bear
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list