Developers use the following syntax code to send email from an ASP.NET application:

 

  • MailMessagemailMess = new MailMessage ();
  • mailMess.From = "[email protected]"
  • mailMess.To = "[email protected]"
  • mailMess.Subject = "Test email";
  • mailMess.Body = "Hi This is a test mail for bestinterviewquestion.";
  • SmtpMail.SmtpServer = "localhost";
  • SmtpMail.Send (mailMess);
BY Best Interview Question ON 20 Jan 2019