Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ASP mail & attach file


Message #1 by "Peter Zsoldos" <paz@c...> on Fri, 22 Jun 2001 09:41:05
hi everybody,

I'd like to ask for information on how can you attach a file to an e-mail, 

which should be sent in ASP....

Also, is it possible to run a .bat file on the server? like I have to 

generate automaticaly a license file from the users given information and 

then e-mail it to him (can I actually store the generated file in an Acces 

database? like in a memo field and create a temporary file to attach to 

the mail and delete it later on?)

well, that's all, i know it is kind of a lot, sorry for that... but if you 

could just send me a link of a _GOOD_ tutorial, that's also perfect :)

please, if you write, send a copy of your mail to pjotr_a@f... 

too, 'cos my normal address doesn't work right now :(



 thanx a lot,



    peter



PS: Is there such a thing as a downloadable ASP reference? with all the 

objects, its methods, etc....?
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 22 Jun 2001 19:23:05 +1000
YOu could use the File System Object to write a text file to the hard disk,

and then attach the text file.



http://www.adopenstatic.com/resources/guide/gettingstarted/links.asp

has link to VBScript and JScript references, plus somewhere for you to

download the Platform SDK (which contains the ADO documentation).



If you want an ASP reference, look at your IIS Help virtual folder in your

webserver on your machine.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "Peter Zsoldos" <paz@c...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, June 22, 2001 9:41 AM

Subject: [asp_databases] ASP mail & attach file





: hi everybody,

: I'd like to ask for information on how can you attach a file to an e-mail,

: which should be sent in ASP....

: Also, is it possible to run a .bat file on the server? like I have to

: generate automaticaly a license file from the users given information and

: then e-mail it to him (can I actually store the generated file in an Acces

: database? like in a memo field and create a temporary file to attach to

: the mail and delete it later on?)

: well, that's all, i know it is kind of a lot, sorry for that... but if you

: could just send me a link of a _GOOD_ tutorial, that's also perfect :)

: please, if you write, send a copy of your mail to pjotr_a@f...

: too, 'cos my normal address doesn't work right now :(

:

:  thanx a lot,

:

:     peter

:

: PS: Is there such a thing as a downloadable ASP reference? with all the

: objects, its methods, etc....?





Message #3 by "Tomm Matthis" <matthis@b...> on Fri, 22 Jun 2001 08:54:27 -0400
Look into using CDO it comes with Win2k and if NT4.0, use CDONTS.



-- Tomm



> -----Original Message-----

> From: Peter Zsoldos [mailto:paz@c...]

> Sent: Friday, June 22, 2001 9:41 AM

> To: ASP Databases

> Subject: [asp_databases] ASP mail & attach file

>

>

> hi everybody,

> I'd like to ask for information on how can you attach a file to

> an e-mail,

> which should be sent in ASP....

> Also, is it possible to run a .bat file on the server? like I have to

> generate automaticaly a license file from the users given information 

and

> then e-mail it to him (can I actually store the generated file in

> an Acces

> database? like in a memo field and create a temporary file to attach 

to

> the mail and delete it later on?)

> well, that's all, i know it is kind of a lot, sorry for that...

> but if you

> could just send me a link of a _GOOD_ tutorial, that's also perfect :)

> please, if you write, send a copy of your mail to pjotr_a@f...

> too, 'cos my normal address doesn't work right now :(

>

>  thanx a lot,

>

>     peter

>

> PS: Is there such a thing as a downloadable ASP reference? with all 

the

> objects, its methods, etc....?



Message #4 by "Peter Zsoldos" <paz@c...> on Fri, 22 Jun 2001 14:50:23
thanx a lot, Ken!



   peter

Message #5 by "Peter Zsoldos" <paz@c...> on Fri, 22 Jun 2001 15:18:58
thanx a lot, I found CDNOT really useful, but i have a problem.

I don't simply want to mail the file,, but it has to be a personally 

generated license file, which is rendered based on the data from a 

database, so i just want to store it temporarly on the server then delete 

it.

problem: i don't have the right to createText file and also I can't open 

the file (i made it on my local machine and uploaded to the server and i 

cannot even open it) somebody about filehandling knows sg.?



thanx, peter



------ CODE -------------------

<html>

<head>

<title>Create file</title>

</head>

<% set FSO = Server.CreateObject("scripting.FileSystemObject") %>

<%

 If Request.Form("txt") <> "" Then

  set myFile = FSO.CreateTextFile("test.txt", true, false)

  myFile.Write(Request.Form("txt"))

  myFile.Close

  set myFile = Nothing

 End if

%>

<body>

<form name=tst action=text.asp method=post>

<textarea name=txt cols=40 rows=10>

<%

 If (FSO.FileExists("test.txt"))=true Then

  Const ForReading = 1, ForWriting = 2, ForAppending = 8



  set f = FSO.GetFile("test.txt")

  set ts = f.OpenAsTextStream(ForReading, -2)

  Do While not ts.AtEndOfStream

       myText = myText & ts.ReadLine & vbCrLf

  Loop

 Response.Write(myText)

%>

<% Else %>

write your text here to create a new 

file called test.txt!

<%  End If %>

</textarea>

<input type=submit value="Save test.txt!">

</form>

</body>

</html>



it was my test, but it didn't work - ithink that the writing part is OK, 

just i don't have the permissions for that  :( what's wrong with reading?



Message #6 by "Tomm Matthis" <matthis@b...> on Fri, 22 Jun 2001 10:56:52 -0400
Why not create the file in memory and send it to a STREAM object, and 

then include that stream object as the attachement to the email?



-- Tomm



> -----Original Message-----

> From: Peter Zsoldos [mailto:paz@c...]

> Sent: Friday, June 22, 2001 3:19 PM

> To: ASP Databases

> Subject: [asp_databases] RE: ASP mail & attach file

>

>

> thanx a lot, I found CDNOT really useful, but i have a problem.

> I don't simply want to mail the file,, but it has to be a personally

> generated license file, which is rendered based on the data from a

> database, so i just want to store it temporarly on the server then 

delete

> it.

> problem: i don't have the right to createText file and also I can't 

open

> the file (i made it on my local machine and uploaded to the server and 

i

> cannot even open it) somebody about filehandling knows sg.?

>

> thanx, peter

>

> ------ CODE -------------------

> <html>

> <head>

> <title>Create file</title>

> </head>

> <% set FSO =3D Server.CreateObject("scripting.FileSystemObject") %>

> <%

>  If Request.Form("txt") <> "" Then

>   set myFile =3D FSO.CreateTextFile("test.txt", true, false)

>   myFile.Write(Request.Form("txt"))

>   myFile.Close

>   set myFile =3D Nothing

>  End if

> %>

> <body>

> <form name=3Dtst action=3Dtext.asp method=3Dpost>

> <textarea name=3Dtxt cols=3D40 rows=3D10>

> <%

>  If (FSO.FileExists("test.txt"))=3Dtrue Then

>   Const ForReading =3D 1, ForWriting =3D 2, ForAppending =3D 8

>

>   set f =3D FSO.GetFile("test.txt")

>   set ts =3D f.OpenAsTextStream(ForReading, -2)

>   Do While not ts.AtEndOfStream

>        myText =3D myText & ts.ReadLine & vbCrLf

>   Loop

>  Response.Write(myText)

> %>

> <% Else %>

> write your text here to create a new

> file called test.txt!

> <%  End If %>

> </textarea>

> <input type=3Dsubmit value=3D"Save test.txt!">

> </form>

> </body>

> </html>

>

> it was my test, but it didn't work - ithink that the writing part is 

OK,

> just i don't have the permissions for that  :( what's wrong with 

reading?

  Return to Index