MailMessage myMess = new MailMessage("pradeep.mudiam@gmail.com","maddulapradeep@gmail.com"); //myMess.From = "info@achbiz.com"; myMess.Subject = "hi"; myMess.Body = "hghhh"; string Body = "jhgg"; AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html"); string Fname = Path.GetFileName(FileUpload1.PostedFile.FileName); string fServerDirPath = Server.MapPath("~/Upload//Document"); //Check Directory Exist or Not if Not Then Create New Directory string fType = FileUpload1.PostedFile.ContentType; Attachment objAttachment1 = new Attachment(FileUpload1.PostedFile.FileName); int fSize = FileUpload1.PostedFile.ContentLength; if (!Directory.Exists(fServerDirPath)) { Directory.CreateDirectory(fServerDirPath); } string fServerFileFullPath = fServerDirPath + Fname; if (fType == "text/plain" || fType == "application/msword" || fType == "application/vnd.ms-excel" || fType == "application/vnd.ms-powerpoint") { if (fSize <= 2097152) //Check Size for 2 MB { FileUpload1.SaveAs(fServerFileFullPath); Response.Write("File Successfully Uploaded"); } else { Response.Write("Please Upload only Maximum 2 MB Size"); } } else { Response.Write("Please Upload only Txt/Doc/XLS/PPT File"); } myMess.Attachments.Add(objAttachment1); myMess.IsBodyHtml = true; SmtpClient mySmtpClient = new SmtpClient(); mySmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; mySmtpClient.Host = "mail.payroll-taxes.info"; mySmtpClient.Port = 25; mySmtpClient.Credentials = new NetworkCredential("support@payroll-taxes.info", "mnb1234"); mySmtpClient.Send(myMess);
myMess.Attachments.Add(objAttachment1); myMess.Attachments.Add(objAttachment2);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)