I am new to CP and wondered if anyone can help me with this issue:
- building windows application
- using .NET 2005 (Framework 2.0)
I am trying to send emails using .Net.Mail but the problem I have is that the emails do not actually send until I exit the application!
I have tried everything I can think of including running this code on its own thread and changing the delivery method but nothing seems to work.
I cannot believe that such a simple thing as sending an email could possible be so damn difficult and frustrating - thanks to Microfault.
Thanks in advance to anyone who can shed some light on this for me.Code:SmtpClient smtp = new SmtpClient("mysmtpserver"); // smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; MailMessage mm = new MailMessage(); mm.IsBodyHtml = true; mm.From = new MailAddress("firstname.lastname@example.org"); mm.ReplyTo = new MailAddress("email@example.com"); mm.To.Add(new MailAddress("firstname.lastname@example.org")); mm.Body = "<HTML><BODY>Message Body</BODY></HTML>"; mm.Subject = "Message Subject"; smtp.Send(mm); mm.Dispose(); mm = null; smtp = null;