using a textfile template
Hi
I have a text file called thankyou.txt
What I'd like to do is use this file (and others) as a template(s) to generate a customized email response :
Dear <% Their Name from database %>
Thank you for your interest in <% item %>
I've seen examples in classic asp, but can't make heads or tails out of it. Would I load the file and then use response to write it?
Any help would be greatly appreciated
Thank you
Re: using a textfile template
You could create the text file in the following format:
Code:
Dear {0}
Thank you for your interest in {1}
Read the text file contents into a string and then use the String.Format method to populate the string. This might not work for more complex messages though.
Code:
string populatedEmailText = String.Format(importedTemplateText, userName, product);
HTH
DJ
Re: using a textfile template
dj4uk
Thank you - I didn't realize format could be used like that. Could come in real handy for short bits. :)
I guess I was hoping there was some way to do a "mail merge" kind of thing (minus the word doc).
Thanks again