smtplib help

David A McInnis david at dataovation.com
Mon Nov 26 11:35:23 EST 2001


Actually, I am using imail from IPSWITCH.  Anyway, it was a speed issue.
When I called time.sleep(2) from the time module giving me a 2 second sleep,
I was able to process the messages.

I don't like being able to send only one msg every 2 seconds.  Any help
would be appreciated.

Sincerely,

David McInnis


-----Original Message-----
From: Paul Brian [mailto:paul1brian at yahoo.com]
Sent: Monday, November 26, 2001 8:01 AM
To: david at dataovation.com
Subject: Re: smtplib help


David

I seriously doubt it - however there is no reason you cannot add in a wait
function
eg

#assume listofmessages is list of 3 element lists; (from, to, msg)
for msg in listofmessages:
    server = smtplib.SMTP('smtp.wibble.com')
    server.sendmail(msg[0], msg[1], msg[2])
    server.quit()
    # truly crude wait function
    for x in range(1,1000000,1):
        pass

however I suspect that the thing will still crash - I doubt there is any
implementation of an SMTP server that will go wrong on a few hundred
messages a second.

What is the smtp server you are using BTW? I assume it is on windows?
Exchange perhaps?

Failing that perhaps you could put the code out to the group, or even try a
different smtp server and see if it still fails.

sorry I cant be more help

P

----- Original Message -----
From: David A McInnis <david at dataovation.com>
To: Paul Brian <paul1brian at yahoo.com>; <python-list at python.org>
Sent: Monday, November 26, 2001 3:45 PM
Subject: RE: smtplib help


> I do call quit().  Is is possible that the script is moving too fast for
the
> smpt server to keep up?  If so, how can I slow it down?
>
> David
>
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Paul Brian
> Sent: Monday, November 26, 2001 6:55 AM
> To: python-list at python.org
> Subject: Re: smtplib help
>
>
> David,
>
> its hard to comment, but I suspect that the error you are getting comes
from
> the SMTP server.
>
> Basically line 222 in smtplib calls on the socket module, which has an
error
> code:
> errorTab[10048] = "The network address is in use." (line 79)
> (I am using 2.1.1 - Your version presumably has a different error msg )
>
> So I suspect that the server is keeping alive sessions - I would check by
> quiting the session each time (xxx.quit()) you send a message.
>
> Hope that helps
>
> David A McInnis <david at dataovation.com> wrote in message
> news:mailman.1006768891.31431.python-list at python.org...
> Any ideas why smtplib would crash on me after about sending 150 email msgs
> (i did not count, but that is a good estimate)?
>
> This is the error that I am getting.
>
>   File "C:\Python21\mm_mime.py", line 93, in Send
>     server = smtplib.SMTP(host)
>   File "C:\Python21\lib\smtplib.py", line 187, in __init__
>     (code, msg) = self.connect(host, port)
>   File "C:\Python21\lib\smtplib.py", line 222, in connect
>     self.sock.connect((host, port))
>   File "<string>", line 1, in connect
> error: (10048, 'Address already in use')
>
> David McInnis
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list

 _________________________________________________________ Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





More information about the Python-list mailing list