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.
Code:
SmtpClient smtp = new SmtpClient("mysmtpserver");
// smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
MailMessage mm = new MailMessage();
mm.IsBodyHtml = true;
mm.From = new MailAddress("[email protected]");
mm.ReplyTo = new MailAddress("[email protected]");
mm.To.Add(new MailAddress("[email protected]"));
mm.Body = "<HTML><BODY>Message Body</BODY></HTML>";
mm.Subject = "Message Subject";
smtp.Send(mm);
mm.Dispose();
mm = null;
smtp = null;
Thanks in advance to anyone who can shed some light on this for me.