Real simple question (so I thought), I just want to send mail from my form without having to Exit() or Restart().
I’ve looked through many examples and they all work but not within a form and the only way I’ve gotten it to work is by calling:
MySmtpClient.Send(MyMailMessage);
MySmtpClient.Dispose();
But this is not available in .NET 2.0 (what my users’ have on their machines).
So I tried using
MySmtpClient.SendAsync(MyMailMessage, MyMailMessage);
and then disposing after the SendCompleted event handler was triggered but it only gets triggered when I exit my form with Application.Exit();
Am I missing something simple?
Thanks.
From ScottGu’s blog
From MSDN
It looks like in .NET 2.0 SmtpClient did not implement IDisposable. If it’s eating your form’s resources, how about: