asp.net c# write string to text file

C#
using (StreamWriter writer = new StreamWriter("email.txt", true)) //// true to append data to the file
{
    writer.WriteLine("your_data"); 
}
Source

Also in C#: