Reputation: 5064
I am trying to make an email sender by C#. I have used System.Net.Mail
to do that. But after doing all the thing when I am going to send the mail using SmtpClient
's Send()
method it throws me exception. why?
code is here
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
SmtpClient sc = new SmtpClient("smpt.live.com");
sc.Port = 587;
sc.Credentials = new System.Net.NetworkCredential("[email protected]", "************");
sc.EnableSsl = true;
sc.Send(mail);
MessageBox.Show("Mail sent", "done", MessageBoxButtons.OK);
exception is coming from sc.Send(mail);
Upvotes: 1
Views: 200
Reputation: 69983
SmtpClient sc = new SmtpClient("smpt.live.com");
Your SMTP server name is likely wrong. Should probably be smtp.live.com
.
Upvotes: 3