Email Script
Hi; I have the following code: def my_mail(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor= database.cursor() ourEmail1 = 'mari...@globalsolutionsgroup.vi' ourEmail1 = 'p...@globalsolutionsgroup.vi' ourEmail2 = 'benoismyn...@gmail.com' 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' Email( from_address = email, to_address = ourEmail1, subject = subject, message = message ).send() Email( from_address = email, to_address = ourEmail2, subject = subject, message = message ).send() 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? TIA, beno -- The Logos has come to bear http://logos.13gems.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Script
On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have the following code: def my_mail(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor= database.cursor() ourEmail1 = 'mari...@globalsolutionsgroup.vi' ourEmail1 = 'p...@globalsolutionsgroup.vi' ourEmail2 = 'benoismyn...@gmail.com' 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' Email( from_address = email, to_address = ourEmail1, subject = subject, message = message ).send() Email( from_address = email, to_address = ourEmail2, subject = subject, message = message ).send() 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? TIA, beno Should I put a timer between instances of Email? -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Script
On Tue, Mar 2, 2010 at 11:53 AM, Victor Subervi victorsube...@gmail.comwrote: On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have the following code: def my_mail(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor= database.cursor() ourEmail1 = 'mari...@globalsolutionsgroup.vi' ourEmail1 = 'p...@globalsolutionsgroup.vi' ourEmail2 = 'benoismyn...@gmail.com' 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' Email( from_address = email, to_address = ourEmail1, subject = subject, message = message ).send() Email( from_address = email, to_address = ourEmail2, subject = subject, message = message ).send() 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? TIA, beno Should I put a timer between instances of Email? Adding a timer didn't work. Do I need to explicitly close the smtp connection before sending the next email? I don't understand why there's a problem. TIA, beno -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Script
Where do you take class Email from? There's no info in your mail on this. Regards, mk -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Script
On Tue, Mar 2, 2010 at 12:56 PM, Victor Subervi victorsube...@gmail.comwrote: On Tue, Mar 2, 2010 at 11:53 AM, Victor Subervi victorsube...@gmail.comwrote: On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have the following code: def my_mail(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor= database.cursor() ourEmail1 = 'mari...@globalsolutionsgroup.vi' ourEmail1 = 'p...@globalsolutionsgroup.vi' ourEmail2 = 'benoismyn...@gmail.com' 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' Email( from_address = email, to_address = ourEmail1, subject = subject, message = message ).send() Email( from_address = email, to_address = ourEmail2, subject = subject, message = message ).send() 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? TIA, beno Should I put a timer between instances of Email? Adding a timer didn't work. Do I need to explicitly close the smtp connection before sending the next email? I don't understand why there's a problem. TIA, beno Seems like the problem was I had to import simplemail for each of the my_email functions. beno -- The Logos has come to bear http://logos.13gems.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Script
Victor Subervi wrote: On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi victorsube...@gmail.com [...] This sends only the first of the two emails. Why doesn't it work to send the second? What do? TIA, beno Should I put a timer between instances of Email? Np. http://en.wikipedia.org/wiki/Cargo_cult_programming regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS:http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list