using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; public partial class Resumeupload : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string name, email, contact, address, products, query, body; name = txtname.Text.Trim(); email = txtmail.Text.Trim(); contact = txtcontact.Text.Trim(); address = txtaddress.Text.Trim(); //query = txtquery.Text.Trim(); body = "Name : " + name + " \n" + "E-mail ID : " + email + " \n" + "Contact No. : " + contact + " \n" + "Address : " + address + ""; MailMessage message = new MailMessage(); MailAddress toAdd = new MailAddress("jobcom10@gmail.com"); message.Subject = "An enquiry has arrived"; Attachment attached = new Attachment(fupload.PostedFile.InputStream, fupload.FileName, fupload.PostedFile.ContentType); message.Attachments.Add(attached); message.IsBodyHtml = true; message.Body = body; // Enter YourSMTPServer SmtpClient client = new SmtpClient(); try { client.Send(message); Response.Redirect("thanku.htm"); } catch { } } }