MailAddress
SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); MailAddress from = new MailAddress("ben@contoso.com", "Ben Miller"); from.DisplayName = "My name"; message.From = from; // Send SMTP mail smtpClient.Send(message);
MailAddress from = new MailAddress"ben@contoso.com", "Ben Miller"); MailAddress to = new MailAddress("jane@contoso.com", "Jane Clayton"); MailMessage message = new MailMessage(from, to); message.Subject = "Using the SmtpClient class."; message.Body = @"This is the body of this email."; SmtpClient client = new SmtpClient(serveraddress); try { client.Send(message); } catch (Exception ex) { Console.WriteLine(ex.ToString()); }
msg.From = new MailAddress("sunnykumar.xyz@abc.com", "Sunny Kumar Test Account");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)