How to use a Text File as a Template to Send Email in C#



Login to See the Rest of the Answer

Answer:

1. Create a text file in your project

2. Code your template in the text file for example:

     <code>Name:  ##Name##
                  E-Maile:  ##Email##
                  Home Phone:  ##Phone##
                  Comments:   ##Comments##

</code>

3. Save and close

4. In your C# code read the text file using "using System.IO" and
string MyFile = Server.MapPath("~/App_Data/ContactForm.txt");
string mailMessage = File.ReadAllText(MyFile)
mailMessage = mailMessage.Replace(""##Name##,"Mack");
mailMessage = mailMessage.Replace(""##Name##,"Mack");


Technology
published
v.0.01





For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email Address[email protected]