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

StackOverflow https://stackoverflow.com/questions/20434765

  •  30-08-2022
  •  | 
  •  

Pergunta

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("wtushar_09@live.com", "wtushar09@gmail.com");
SmtpClient sc = new SmtpClient("smpt.live.com");
sc.Port = 587;
sc.Credentials = new System.Net.NetworkCredential("wtushar_09@live.com", "************");
sc.EnableSsl = true;
sc.Send(mail);
MessageBox.Show("Mail sent", "done", MessageBoxButtons.OK);

exception is coming from sc.Send(mail);

Foi útil?

Solução

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

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top