473,662 Members | 2,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("m ode")
From = request.form("f rom")
Ext = request.form("e xt")
Subject = request.form("s ubject")
Body = request.form("b ody")

if mode = "Send" then

Set Mail = Server.CreateOb ject("Persits.M ailSender")
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.serverv ariables("REMOT E_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("S cripting.FileSy stemObject")

' Open the file
'Set objTextFile = objFSO.OpenText File("C:\InetPu b\PR86027\sampl es\textfile.txt ")
Set objTextFile = objFSO.OpenText File(Server.Map Path("textfile. txt"))

Do While Not objTextFile.AtE ndOfStream
Response.Write objTextFile.Rea dLine & "<BR>" & vbCrLf
Loop

' Close the file.
objTextFile.Clo se

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

' Release reference to the File System Object.
Set objFSO = Nothing
%>
Jul 19 '05 #1
2 1751
put it all in one page

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"dmiller234 62" <dm**********@y ahoo.com> wrote in message
news:59******** *************** ***@posting.goo gle.com...
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("m ode")
From = request.form("f rom")
Ext = request.form("e xt")
Subject = request.form("s ubject")
Body = request.form("b ody")

if mode = "Send" then

Set Mail = Server.CreateOb ject("Persits.M ailSender")
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.serverv ariables("REMOT E_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("S cripting.FileSy stemObject")

' Open the file
'Set objTextFile = objFSO.OpenText File("C:\InetPu b\PR86027\sampl es\textfile.txt ") Set objTextFile = objFSO.OpenText File(Server.Map Path("textfile. txt"))

Do While Not objTextFile.AtE ndOfStream
Response.Write objTextFile.Rea dLine & "<BR>" & vbCrLf
Loop

' Close the file.
objTextFile.Clo se

' 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.CreateOb ject("Persits.M ailSender")
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.serverv ariables("REMOT E_ADDR")

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

' ASSUMES THE PREMIUM VERSION OF ASPEMAIL

strFile = "C:\path\to\fil e\fileToAppend. txt"
mail.appendBody FromFile 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("m ode")
From = request.form("f rom")
Ext = request.form("e xt")
Subject = request.form("s ubject")
Body = request.form("b ody")

if mode = "Send" then

Set Mail = Server.CreateOb ject("Persits.M ailSender")
Mail.Host = "gwfs1" ' Specify a valid SMTP server
Mail.From = "dm*****@coach. com" ' Specify sender's address
Mail.FromNam e = "Dave Miller - Test Email" ' Specify sender's name
if subject = "" then
Mail.Subject = "Test Email"
else
Mail.Subject = subject
end if

Mail.AddAddres s "dmiller"
Mail.AddReplyT o "dm*****@coach. com"

Mail.Body = body & vbcrlf & vbcrlf &
request.server variables("REMO TE_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("S cripting.FileSy stemObject")

' Open the file
'Set objTextFile = objFSO.OpenText File("C:\InetPu b\PR86027 \samples\textfi le.txt")Set objTextFile = objFSO.OpenText File(Server.Map Path ("textfile.txt" ))
Do While Not objTextFile.AtE ndOfStream
Response.Write objTextFile.Rea dLine & "<BR>" & vbCrLfLoop

' Close the file.
objTextFile.Cl ose

' 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
1001
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 of RFC 2822 headers. My naive hope was to inherit from both: class UploadRequest(urllib2.Request, email.MIMEMultipart)
13
3784
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 non-printing)...in Windows you need the (0x0d 0x0a) pair, if you want a new-line in a text editor. What's the correct way to get this 2-byte sequence into a file? Thanks #include <iostream>
8
9845
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 | ios::binary) to declare a file object with read/write modes turned on for working with binary data. I've tried this and my file is not created. The only time it is created is when I specify ifstream or ofstream but not fstream. I've tried removing the...
11
2603
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 after that row from where the search string was found ? Of course the row where the string was found should also be read. I have a log file in txt format. I need to read the file if
6
2041
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 reference the project file in xslt.run(string PathName) without it looking in c:\windows\system32 directory for the file? -- Thanks, Harry
3
1261
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 column. i am trying to get all the email addresses to be clickable email links using the mailto: scenerio but am having trouble with code as im a newbie.
7
1833
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 in the file twice, first to determine number of lines. Then a second time to write a copy of the reduced log file. Any simpler workarounds?
16
2986
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 the file. The text file would be a record of orders placed through a web form. The text file would merely be a record of the orders but it needs to be in descending date order - each new record added to the beginning.
3
1907
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 label from each record with a reference for which certificate to enclose (also from the database). (Happy to share this if anyone wants it). Thing is that I get a label for each certificate when I could put up to 4 certificates in a single mailing...
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.