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.