Using the CSV file is by far the easiest.
Just before the Response.Redirect line at the end, add this code:
The only thing to watch out for is here:
CONST QT = """" ' creates a single quote mark
' put the items into the array in whatever order you prefer:
csvItems = Array( UserIPAddress, strFeedTitle, strFeedName, strFeedEmail, _
strFeedCell, strFeedCompany, strFeedSubject, strFeedMessage )
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set csv = FSO.OpenTextFile( Server.MapPath("emailLog.csv"), 8, True )
csv.WriteLine QT & Join( csvItems, QT & "," & QT ) & QT
Set FSO = Nothing
Aside from the fact that you can use any file name of your choice, though it should end in ".csv", that code as written probably won't work. That says "find the CSV text file in the same directory as this code." Almost surely the directory with the code will *NOT* be writable.
Typically, you will have a writable "data" directory that is either a subdirectory of the code directory or is "besided" the code subdirectory. So you will likely need something such as
You will have to figure that part out based on the directory structure on your machine.
This code should write out a CSV file that looks like
TWO CAUTIONS: In a ".csv" file like this, *NONE* of the field may contain *EITHER* quote marks or new line characters.
"18.104.22.168","Amalgamated Widgets","Today's Widget Report","...", etc.
If you are unsure if they might, you could use a "cleaner" function something like:
And then construct the array using that function:
Function clean( txt )
clean = Replace( Replace( Replace( txt, """","'" ), vbCR, " ", vbLF, " " )
Give it a shot!
csvItems = Array( UserIPAddress, clean(strFeedTitle), clean(strFeedName), _
clean(strFeedEmail), clean(strFeedCell), clean(strFeedCompany), _
clean(strFeedSubject), clean(strFeedMessage) )