-7

I want to send email via C#, how i can do this by the correct way? I should use

System.Net.Mail
MailMessage mail = new MailMessage();

And now?

Maveňツ
  • 1
  • 12
  • 50
  • 89
Ander G
  • 11
  • 1

1 Answers1

2
SmtpClient SmtpServer = new SmtpClient("mail.provider.com.br");
mail.From = new MailAddress("noreply@provider.com.br");
mail.To.Add("youremail@provider.com.br");
mail.Subject = "Some title";
mail.Body = "YOUR TEXT GOES HERE";
SmtpServer.Port = 'port';
//credentials
SmtpServer.Credentials = new System.Net.NetworkCredential("youremail@provider.com.br", "pa$$word");
SmtpServer.Send(mail);
Maveňツ
  • 1
  • 12
  • 50
  • 89
Gustavo Henrique
  • 138
  • 1
  • 14
  • 2
    Just be aware that your post is code-only (and is answered for sure before). If you decide to answer, at least try to put some more effort in. – rene Jun 30 '15 at 20:58