It's officaially time for me to stop and ask for directions! FYI I'm new
to VBscript and aim to create scripts to automate some of the things i
wish to do.



Heres my current task.



I need to test a spam filter using content contained in about 2000
seperate .txt files. I have successfully gotten my script to work with
the first txt file. But I have NO idea how to make the script process
each txt file into a seperate outgoing email.



Here's the code:



------------------------------------------------------------------
----------



Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.OpenTextFile _

("spamfile1.txt", ForReading)

strResponses = objTextFile.ReadAll





Set objEmail = CreateObject("CDO.Message")

objEmail.From = InputBox( "Type a senders address for spam here" )

objEmail.To = InputBox( "Type Target email address for spam here" )

objEmail.Subject = "Spam filter test"

objEmail.Textbody = strResponses

objEmail.Send



MsgBox "Your SPAM has been sent to " & _

objEmail.To



objTextFile.close



------------------------------------------------------------------------
------------



As you can see the current script is setup to only process 1 txt file
and 1 email. Again my goal is for the script to process each text file
(2000 of them) and then generate 2000 seperate emails which i will
direct at my content filter for testing.



Any help would e GREATLY appreciated and I apologize in advance if I
have asked a completely rudementary question. I am testing this for a
school that I volunteer IT time for so it is a non profit objective.



Thx again-


--
Posted via http://dbforums.com

Re: Help with mailer script! by Christoph

Christoph
Fri Oct 24 12:46:05 CDT 2003


On Thu, 23 Oct 2003 13:48:29 -0400, kizzane wrote:

>
> It's officaially time for me to stop and ask for directions! FYI I'm new
> to VBscript and aim to create scripts to automate some of the things i
> wish to do.
>

Hi,

it's really an easy task, look at the code below i pasted from a sample and
i'm sure you're able to use it for your advance..

BG Christoph

<snip>
Set wshShell = CreateObject("WScript.Shell")
Set fsoObject = CreateObject("Scripting.FileSystemObject")


Dim strConstPathInputFolder
strConstPathInputFolder =
Left(WScript.ScriptFullName,InStrRev(WScript.ScriptFullName,"\")) &
"scripts"

If not fsoObject.FolderExists(strConstPathInputFolder) Then
wshShell.LogEvent 1,"Folder existiert nicht.. : "
Exit Function
End If

Set fdFolder = fsoObject.GetFolder(strConstPathInputFolder)

'==========================================================================
' Enumerate the files of the folder
'==========================================================================
For each strFile in fdFolder.Files
'do what ever you need to do with each file..
Next

</snip>

--
E-Mail: puevfgbcu.jvysvat@tzk.arg [ROT-13]