728x90
// Command line argument must the the SMTP host. SmtpClient client = new SmtpClient(); client.Port = 587; client.Host = "smtp.gmail.com"; client.EnableSsl = true; client.Timeout = 10000; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential("user", "password"); MailMessage msg = new MailMessage("sendaddr@gmail.com", "receiver@domail.com", subject, body); msg.BodyEncoding = UTF8Encoding.UTF8; msg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; client.Send(msg);
728x90
728x90