Email Script
Victor Subervi
victorsubervi at gmail.com
Tue Mar 2 11:56:58 EST 2010
On Tue, Mar 2, 2010 at 11:53 AM, Victor Subervi <victorsubervi at gmail.com>wrote:
> On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi <victorsubervi at gmail.com>wrote:
>
>> 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 = 'marilyn at globalsolutionsgroup.vi'
>> ourEmail1 = 'phil at globalsolutionsgroup.vi'
>> ourEmail2 = 'benoismyname at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100302/a3dac1ca/attachment-0001.html>
More information about the Python-list
mailing list