|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System.Net.Mail.SmtpClient SendAsync Limits? (.Net 2.0)I have a quick question regarding the functionality of the SendAsync function, but before I get to the question here is a description of what I am attempting to do. I am setting up a Windows Service that on a Timed based interval it will query a database of queued emails for mail delivery. So from time to time the email list can be as much as 38,000 emails. So the service is setup to loop through the record set of maximum 500 emails at a time. There are two approachs I can take to make the delivery happen: ================================== 1. Send the email Synchronously and specify a Timeout. This will force the program to wait until the email either errors out or is completed. So it may take a little longer to deliver. 2. Send the email Asynchronously and specify the call back so that one completion or error I can handle the event and delete from the queue. I am guessing this method will spead things up, because all 500 emails can be scheduled for delivery within seconds. ================================== Option #1 seems to be the safest approach, but to not hold up the application I would like to use the Option #2. Now my questions are: ================================== 1. What option do you guys think would be best? 2. If I use Async method to send an email but they take time to connect and delivery, how many threads would be created and how much memory/cpu would be used? ================================== I would just hate to have the server lose a ton of resources to send out the emails and bring down the performance of the server. Since the server is being used for multiple websites, and so on. I just want to know what is the suggested use for Async. Thanks in advance for the advice. Jose |
|||||||||||||||||||||||