473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Email AND File Appends

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 = "dm*****@coach.com" ' 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 "dm*****@coach.com"

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\te xtfile.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
%>
Jul 19 '05 #1
2 1739
put it all in one page

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
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 = "dm*****@coach.com" ' 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 "dm*****@coach.com"

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\te xtfile.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
%>

Jul 19 '05 #2
Using Persits ASP Email... it is way easier than you are
doing... if you are using the premium version

Try:

Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "gwfs1"
Mail.From = "dm*****@coach.com"
Mail.FromName = "Dave Miller - Test Email"
if subject = "" then
Mail.Subject = "Test Email"
else
Mail.Subject = subject
end if
Mail.AddAddress "dmiller"
Mail.AddReplyTo "dm*****@coach.com"
Mail.Body = body & vbcrlf & vbcrlf &
request.servervariables("REMOTE_ADDR")

' -------------------------------------

' ASSUMES THE PREMIUM VERSION OF ASPEMAIL

strFile = "C:\path\to\file\fileToAppend.txt"
mail.appendBodyFromFile strFile, true

' Note the true appends it to the Body
' If it were false it would append it to
' the AltBody (for multipart messages)

' -------------------------------------

On Error Resume Next

Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End if
-----Original Message-----
I would like to append to a file, AS WELL AS, send an email viaASP....I have some sample code from ASP101.com and am planning onmodifying it to my uses but I don't know where exactly I should placeit....Should I begin a whole new set of ASP commands or should Iincorporate it into the current ASP that specifies an email beingsent?

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 = "dm*****@coach.com" ' 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 "dm*****@coach.com"

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 beaccessed.
Dim objFSO, objTextFile

' Create an instance of the the File System Object and assign it toobjFSO.
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>" & vbCrLfLoop

' Close the file.
objTextFile.Close

' Release reference to the text file.
Set objTextFile = Nothing

' Release reference to the File System Object.
Set objFSO = Nothing
%>
.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stephen Waterbury | last post by:
I'm creating an HTTP client file-upload function and noticed that there seems to be no nice way of using urllib2.Request and email.MIMEMultipart together, due to their inconsistent representations...
13
by: J. Campbell | last post by:
I'm wanting to output a text header file in front of the data portion of an output file. However when I use "\n" or "endl" as end of line, it just puts a 0x0a in the file(which is...
8
by: Brandon McCombs | last post by:
This may be the wrong group but I didn't see anything for VC++ so I'm trying here. I have a C++ book by Deitel and Deitel that says I can use fstream File("data.dat", ios::in | ios::out |...
11
by: mkarja | last post by:
Hi, I'm trying to figure out how to read some range of rows from a file. Is it possible to search the file with some criteria and then when the search string is found read 3 rows before and...
6
by: Harry Riddle | last post by:
I am trying to modify someone else's XML code and I am having problems. They hard-coded the location of an xslt file in a database and I want to make the file a part of the project. How do I...
3
by: kieran | last post by:
Hi, i know this should be easy but cant get it exactly right. i have a Datagrid pulling results from a stored proc in database, it outputs four columns, one of which is an email address...
7
by: veg_all | last post by:
I am looking for a simple way to keep my log files from growing too large. Basically I would want something that truncates the off first 25 kb of a 100kb log file. I could do something with reading...
16
by: btopenworld | last post by:
Hi - question from a relative asp novice I have written to text files in the past, but always appending new data to the end of the text file. I now want to add the new data to the beginning of...
3
by: PaulH13 | last post by:
Hi, I have a pipe delimited flat file database of students that I mail out certificates to. I wrote a label preparation script which basically passes through the file and prepares a mailing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.