protected void submit_Click(object sender, EventArgs e) { String body = "<html><body>"; // (MRB Edit:) // Deleted lots of these: body += ""; // as they weren't doing anything useful body += " Name of Organization : " + name_organization.Text.Trim() + "Address: " + address.Text.Trim() + "Tel. No.:" + tele_no.Text.Trim() + "Fax : " + fax_no.Text.Trim() + " Mobile : " + mobile_no.Text.Trim() + "Company Email :" + company_email.Text.Trim() + "Contact Person : " + contact_person.Text.Trim() + "Accident Description :" + other_information0.Text.Trim() + "Contact Person : " + level_participants.Text.Trim() + "Picture of the Exact Location :" + object_training.Text.Trim() + "Any other information :" + other_information.Text.Trim() + ""; body += "</body></html>"; string attach3 = null; string strFileName = null; MailMessage mail = new MailMessage(); mail.From = new MailAddress("XXXXX.XXXX@ask-ehs.com"); mail.To.Add("XXXXX.XXXX@ask-ehs.com"); mail.Subject = name_organization.Text; mail.Body = body; mail.IsBodyHtml = true; mail.Priority = MailPriority.High; if (fileImage.PostedFile != null) { HttpPostedFile attFile = fileImage.PostedFile; int attachFileLength = attFile.ContentLength; if (attachFileLength > 0) { strFileName = Path.GetFileName(fileImage.PostedFile.FileName); fileImage.PostedFile.SaveAs(Server.MapPath(strFileName)); Attachment attach = new Attachment(Server.MapPath(strFileName)); mail.Attachments.Add(attach); attach3 = strFileName; } } SmtpClient smtp = new SmtpClient("127.0.0.1"); smtp.Send(mail); clear(); Response.Redirect("enquiry_accident_scenario_thanks.html"); }
new SmtpClient("127.0.0.1");
SMTP
loopback IP
telnet 127.0.0.1 25
telnet
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)