try { mail = new MailMessage(); mail.To.Add(ConfigurationManager.AppSettings["PaypalEmail2"].ToString()); mail.From = new MailAddress("abc@gmail.com"); mail.Subject = "File Downloaded to VAM"; mail.Body = "Name : " + txtName.Text + "\n Contact Details : " + txtPhone.Text + "\n Email ID :" + txtEmail.Text + "\n"; mail.IsBodyHtml = true; if (flpFile.HasFile) { mail.Attachments.Add(new Attachment(flpFile.PostedFile.InputStream, flpFile.FileName)); } smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "sample"); smtp.EnableSsl = true; smtp.Send(mail); txtEmail.Text = txtName.Text = txtPhone.Text = string.Empty; } catch (Exception ex) { // so something } finally { mail = null; smtp = null; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)