Sunday 20 March 2016

Send Email Using SMTP Client

System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("ToEmailAddress");
message.Subject = "The subject";
message.From = new System.Net.Mail.MailAddress("FromEmailAddress");
message.Body = "Email Body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("Address to your SMPT server");
smtp.Send(message);

No comments:

Post a Comment