Difference between smtpClient.send() and smtpClient.SendAsync()?

divya picture divya · May 30, 2011 · Viewed 12.6k times · Source

I am trying to send mail from localhost..

and on doing this i have got methods from different sites to sending mails..but on doing this i am confused between smtpClient.send() and smtpClient.SendAsync()..

I want to know that How they are different from each other???

Thanks in advance..

Answer

Aseem Gautam picture Aseem Gautam · May 30, 2011

smtpClient.send() will initiate the sending on the main/ui thread and would block.
smtpClient.SendAsync() will pick a thread from the .NET Thread Pool and execute the method on that thread. So your main UI will not hang or block.

Async Method Invocation - http://www.codeproject.com/KB/cs/AsyncMethodInvocation.aspx