Reputation: 373
I have an ASP Form. I wish to send the completed form details, in HTML, with proper formatting (table).
The old way I was doing was writing an entire script into a variable, then sending the message that way.
message = "<html><body>"
message = message + " "&_ 'Many lines of codes!
message = message + "</body></html>"
As my form can get very long, do you all have a better recommendation on how I can send an entire HTML page, without putting it within a variable?
Upvotes: 0
Views: 643
Reputation: 3077
Create template.html and layout the page any way you like. If you are broadcasting to multiple recipients, you can put the text like this "Hi [varFirstName]" in your template.
Then you can import that template file in the code as follow.
Dim fso,templatesource,body
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set templatesource = fso.OpenTextFile(server.MapPath("template.html"))
template=templatesource.ReadAll
template= Replace(template,"[varFirstName]",rsSource("firstname"))
file.close
templatesource.close
Set templatesource = nothing
Set fso = nothing
Upvotes: 1