0

I want to send email to customer of listview generated rows from database. I have made html page to send email & in that I want to place a table where I want to show listview rows. I seen one post in aspsnippets . But here they are not creating separate html page. Because I have other dynamic information to send in that email so Is it possible to use html page & parse listview rows under that table.

Currently I am using this code

try {
    StreamReader reader = new StreamReader(Server.MapPath("/order-cancel-format.html"));
    string readFile = reader.ReadToEnd();
    string myString = "";
    myString = readFile;
    myString = myString.Replace("$$firstName$$", userName.Text);
    myString = myString.Replace("$$orderIDCode$$", myOrderID.Text);
    MailMessage mail = new MailMessage();
    SmtpClient SmtpServer = new SmtpClient();
    mail.To.Add(userEmail.Text);
    mail.From = new MailAddress("info@foxboxretail.com");
    mail.Subject = "Cancellation of your Order " + myOrderID.Text + "";
    mail.Body = myString.ToString;
    mail.IsBodyHtml = true;
    SmtpServer.Port = 25;
    SmtpServer.Credentials = new System.Net.NetworkCredential("info@domain.com", "password123");
    SmtpServer.Host = "relay-hosting.secureserver.net";
    SmtpServer.EnableSsl = false;
    SmtpServer.Send(mail);
} catch (Exception ex) {
    Response.Write(ex);
}
SUN
  • 973
  • 14
  • 38

0 Answers0