Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Response

Status
Not open for further replies.

wwcbill

Programmer
Jul 31, 2002
11
US
I am new to Javascript and I have written code to allow me to read e-mail addresses from my hard drive. I want to submit a form containg each email one at a time. When the form is submitted I DO NOT get a response from my auto responder, although I get an acknowledgemnet that the form was submitted successfully. When I log into my accout, there is no indication that any of the submitted forms ever arrived. The code I used is below. Thank you for your help!

_________________________________________
<HTML>
<HEAD>
<TITLE>Bill's-send-mail</Title>
</HEAD>
<BODY LINK=&quot;#0000ff&quot;>



<script Language=&quot;JavaScript&quot;>
<!--Hide
// function submits a form
function submitForm(frm){
document.form1.submit(frm);
}
// End Hide -->
</SCRIPT>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;<input type=&quot;hidden&quot; name=&quot;type&quot; value=&quot;1&quot;>
<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;39241&quot;>
<input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;Bill Corbett&quot; size=&quot;40&quot;>
<input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;billMesg&quot;>
<input type=&quot;hidden&quot; value=&quot;Submit&quot; onclick = submitForm(this.form)>
</form>

<script Language=&quot;JavaScript&quot;>

// Create an instance of the File object.
var myFileSysObj = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);

// Try to open the file.
var myInputTextStream = myFileSysObj.OpenTextFile(&quot;c:\\onemail.txt&quot;,1,true);

// If there was not an error, then open the file and display it.
while(!myInputTextStream.AtEndOfStream){
var billMesg = myInputTextStream.ReadLine();
submitForm();
}
// Close the input
myInputTextStream.Close()
</SCRIPT>

</BODY>
</HTML>
 
First, your submitForm() function takes one argument, and you're not passing it any parameters in your loop.

Second, it appears that you're mixing WSH functions in Javascript with client side Javascript, and that won't work. Except for one buggy version of IE 6 that MS fixed, as far as I know, you can't access files with scripting from a browser window.

Also, what you're trying to do sounds an awful lot like what the dozens (hundreds?) of email viruses do as WSH files.
 
What is a &quot;WSH&quot; function? The code I used came from &quot;Pure JavaScript&quot; pg 725 (Form.submit) and pg 1303 (TexStream.ReadLine). What should i put as a parm in &quot;SubmitForm()&quot;
 
WSH is Windows Scripting Host, which is the program that runs scripting files on your computer like batch files. You can use Javascript for Windows Scripting Host programs, as well as web pages, but you can't mix the WSH objects (like file and disk access) with browser objects.
 
Trollacious.
Thank you for the definition of &quot;WSH&quot;. I have not learned about &quot;WSH&quot; but I can read from my hard drive, using &quot;ActiveXObject&quot;. Maybe this is part of &quot;WSH&quot;. At this point I do not know how to include the e-mail addresses I read from my hard drive into the form I send to my auto responder. Is it possible to creat a varible that I can include as the e-mail address as part of my form?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top