SmtpClient client = new SmtpClient();
client.Port = 25;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.Timeout = 10000000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("asad.naeem@gmail.com", "Password");
// MailMessage mm = new MailMessage("asad.naeem@gmail.com", "asad.naeem@gmail.com", "test", "test");
MailMessage mm = new MailMessage("FromEmail", "ToEmail", "Subject", "Body");
mm.BodyEncoding = UTF8Encoding.UTF8;
mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
client.Send(mm);
MessageBox.Show("Email Sent");
No comments:
Post a Comment