Add date to a n Email Form

Discussion in 'ASP.NET / ASP.NET Core' started by Merv Norton, Jan 25, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a simple Email Form. Here is the key code:

    SmtpClient sc = new SmtpClient("localhost");
    StringBuilder sb = new StringBuilder();
    MailMessage msg = null;

    sb.Append("Email from: " + txtEmail.Text + "\n");
    sb.Append("Message : " + txtMessage.Text + "\n");

    How cad I add the current date to the body od the Message?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    do something like this

    sb.Append("Message : " + txtMessage.Text + "\n" + DateTime.Now.ToString("MMM dd, yyyy"));
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page