D
dmiller23462
I would like to append to a file, AS WELL AS, send an email via
ASP....I have some sample code from ASP101.com and am planning on
modifying it to my uses but I don't know where exactly I should place
it....Should I begin a whole new set of ASP commands or should I
incorporate it into the current ASP that specifies an email being
sent?
EMAIL BEING SENT
***
<%
Mode = request.form("mode")
From = request.form("from")
Ext = request.form("ext")
Subject = request.form("subject")
Body = request.form("body")
if mode = "Send" then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "gwfs1" ' Specify a valid SMTP server
Mail.From = "(e-mail address removed)" ' Specify sender's address
Mail.FromName = "Dave Miller - Test Email" ' Specify sender's name
if subject = "" then
Mail.Subject = "Test Email"
else
Mail.Subject = subject
end if
Mail.AddAddress "dmiller"
Mail.AddReplyTo "(e-mail address removed)"
Mail.Body = body & vbcrlf & vbcrlf &
request.servervariables("REMOTE_ADDR")
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End if
%>
SAMPLE CODE TO APPEND TO A FILE
***
<%
' Declare variables for the File System Object and the File to be
accessed.
Dim objFSO, objTextFile
' Create an instance of the the File System Object and assign it to
objFSO.
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Open the file
'Set objTextFile = objFSO.OpenTextFile("C:\InetPub\PR86027\samples\textfile.txt")
Set objTextFile = objFSO.OpenTextFile(Server.MapPath("textfile.txt"))
Do While Not objTextFile.AtEndOfStream
Response.Write objTextFile.ReadLine & "<BR>" & vbCrLf
Loop
' Close the file.
objTextFile.Close
' Release reference to the text file.
Set objTextFile = Nothing
' Release reference to the File System Object.
Set objFSO = Nothing
%>
ASP....I have some sample code from ASP101.com and am planning on
modifying it to my uses but I don't know where exactly I should place
it....Should I begin a whole new set of ASP commands or should I
incorporate it into the current ASP that specifies an email being
sent?
EMAIL BEING SENT
***
<%
Mode = request.form("mode")
From = request.form("from")
Ext = request.form("ext")
Subject = request.form("subject")
Body = request.form("body")
if mode = "Send" then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "gwfs1" ' Specify a valid SMTP server
Mail.From = "(e-mail address removed)" ' Specify sender's address
Mail.FromName = "Dave Miller - Test Email" ' Specify sender's name
if subject = "" then
Mail.Subject = "Test Email"
else
Mail.Subject = subject
end if
Mail.AddAddress "dmiller"
Mail.AddReplyTo "(e-mail address removed)"
Mail.Body = body & vbcrlf & vbcrlf &
request.servervariables("REMOTE_ADDR")
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End if
%>
SAMPLE CODE TO APPEND TO A FILE
***
<%
' Declare variables for the File System Object and the File to be
accessed.
Dim objFSO, objTextFile
' Create an instance of the the File System Object and assign it to
objFSO.
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Open the file
'Set objTextFile = objFSO.OpenTextFile("C:\InetPub\PR86027\samples\textfile.txt")
Set objTextFile = objFSO.OpenTextFile(Server.MapPath("textfile.txt"))
Do While Not objTextFile.AtEndOfStream
Response.Write objTextFile.ReadLine & "<BR>" & vbCrLf
Loop
' Close the file.
objTextFile.Close
' Release reference to the text file.
Set objTextFile = Nothing
' Release reference to the File System Object.
Set objFSO = Nothing
%>