Bernard

Bernard

  • NA
  • 78
  • 0

Send mail with SmtpClient via smtp.live.com

Nov 30 2010 1:13 AM
Hi everyone,
first thanks in advance for any help.
Here is my problem:
I can't get any email from my code:

                MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("[email protected]", "Bernard Lessard");
mailMessage.To.Add(new MailAddress("[email protected]"));
mailMessage.Subject = "Your BabyfootClub username and password.";
mailMessage.Body = "Your username is: " + sUsername + "\r\n";
mailMessage.Body += "Your password is: " + sPasswrod + "\r\n";

SmtpClient smtpClient = new SmtpClient("smtp.live.com", 587);
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "mypassword");
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

smtpClient.Send(mailMessage);

Am I missing something?
A config in the Web.config maybe?
I'm actually inside a WCF service.

Thanks


Answers (1)