<p>I'm using a preformatted text file as a template for emails. The file has line breaks where I want them. I'd like to use this template to send a plain text email, but when I do I'm losing all formatting. Line breaks are stripped.</p>

<p>How do I parse this file and retain line breaks? I don't want to use a <code>&lt;pre&gt;</code> tag because I want to send plain text emails. </p>

<p>I'm using the classic ASP ReadAll method to pull the template into a string:</p>

<pre><code>            Dim TextStream
        Set TextStream = FSO.OpenTextFile(Filepath, ForReading, False, TristateUseDefault)

        ' Read file in one hit
        Dim Contents
        GetTemplate = TextStream.ReadAll ' return file contents
</code></pre>

<p>What am I missing?</p>

this is what I have done...
I take a text, or HTML file, ( I'll show text, since its smaller, but the exact same code applies ), and I put well know values into the text file that I can later replace.
-- Begin Text File
```
```
We've generated a new password for you at your request, you can use this new password with your username to log in to various sections of our site.

Username: ##UserName##
Temporary Password: ##Password##

To use this temporary password, please copy and paste it into the password box.

Please keep this email for your records.
```
```
-- End Text File
Then its a simple matter of creating a list of key/value pairs, with the text to be replaced, and the value your replacing it with. Load the file into memory as a string, and loop through your key/value pair replacing your text values.
```
```
ListDictionary dictionary = new ListDictionary
                                            {
                                                {"##UserName##", user.BaseUser.UserName},
                                                {"##Password##", newPassword}
                                            };

            string fromResources = GetFromResources("forgotpasswordEmail.html");
            string textfromResources = GetFromResources("forgotpasswordEmail.txt");
            foreach (DictionaryEntry entry in dictionary)
            {
                fromResources = fromResources.Replace(entry.Key.ToString(), entry.Value.ToString());
                textfromResources = textfromResources.Replace(entry.Key.ToString(), entry.Value.ToString());
            }
```
```
Then you can email the text, ( in this case the textfromResources variable ), and it will contain all of the necessary line breaks and formatting.
Like I said, you can do this eact same thing with HTML files, or any type of file you want to.
Although my example is in C#, ( I don't have any classic ASP code handy, sorry ), the concept of finding and replacing values will apply to classic ASP.