MailMessage Message = new MailMessage(); Message.IsBodyHtml = true; string to=txtCustEmail.Text; string from = txtYourEmail.Text; string password = txtPass.Text; Message.To.Add(new MailAddress(to)); Message.From = (new MailAddress(from, "ADMIN")); Message.Subject = txtMsgSub.Text; Message.Body = txtMsgBody.Text; Message.Attachments.Add(new Attachment("D:\\Excise2.xlsx")); NetworkCredential NetworkCred = new NetworkCredential(from, password); SmtpClient sc =new SmtpClient(); if (radioButton1.Checked==true) { sc = new SmtpClient("smtp.gmail.com"); } if (radioButton2.Checked==true) { sc = new SmtpClient("smtp.logix.in"); } if (radioButton3.Checked == true) { sc = new SmtpClient("smtp.rediffmail.com"); } sc.Port = 587; //sc.Host= sc.Credentials = NetworkCred; sc.EnableSsl = true; sc.Send(Message); MessageBox.Show("Email send to " + Message.To); Message.Dispose();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)