dingir
asked on
How to avoid: Net.Mail.SmtpException IO Exception errors
I use a script thet sends ten thousends of mail. I've got a strange error that occurs every 2 minutes and 40 seconds (more or less exactly). The error is
System.Net.Mail.SmtpExcept ion: Failure sending mail. ---> System.IO.IOException: Unable to write data to the transport
connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketE xception:
An established connection was aborted by the software in your host machine at System.Net.Sockets.Socket. Send(Byte[ ] buffer,
Int32 offset, Int32 size, SocketFlags socketFlags) ............... at System.Net.Mail.SmtpClient .Send(Mail msg msg)
at ....SmtpSend(......) in ...Message.cs:line 127
I create a smtpclient with smtpclient client = new smtpclient(), then I put the client.Send(msg) itself in a try catch. That catch gives me the error description... until then the script was stopped after this.. now the catch are hooking it up and continue the script.. but how do I avoid this?
Seems to me like a bufffer that can't take all data because any garbage collection that does not work enough well.. ?!
System.Net.Mail.SmtpExcept
connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketE
An established connection was aborted by the software in your host machine at System.Net.Sockets.Socket.
Int32 offset, Int32 size, SocketFlags socketFlags) ............... at System.Net.Mail.SmtpClient
at ....SmtpSend(......) in ...Message.cs:line 127
I create a smtpclient with smtpclient client = new smtpclient(), then I put the client.Send(msg) itself in a try catch. That catch gives me the error description... until then the script was stopped after this.. now the catch are hooking it up and continue the script.. but how do I avoid this?
Seems to me like a bufffer that can't take all data because any garbage collection that does not work enough well.. ?!
ASKER
Thank's! That may do it? Are yu possible to provide me with a code sample that run a thread for example 500 loops and paus 3 seconds, then continue running?
As the functions is today, they create a thread with
Threading.Thread t = new threading.thread()
t.start(function)
that's it
As the functions is today, they create a thread with
Threading.Thread t = new threading.thread()
t.start(function)
that's it
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank's a lot.. i will check it up.. :)
1. Sending a set number of email in a specific timeframe
2. Delay thread for a few milliseconds after sending each email - Thread.Sleep(50)
DaTribe