Tushar Monirul
Tushar Monirul

Reputation: 5064

Why it is throwing an exception when I am trying to send an email by SmtpClient.Send method?

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

Answers (1)

Brandon
Brandon

Reputation: 69983

SmtpClient sc = new SmtpClient("smpt.live.com");

Your SMTP server name is likely wrong. Should probably be smtp.live.com.

Upvotes: 3

Related Questions