...

View Full Version : E-mail help



wwcbill
07-26-2002, 10:19 PM
I have written the following code. I am new to Java Script and can not uderstand why it wont work. Can someone please help?
The code requires a text file of e-mail addresses on the "C" drive.

<HTML>
<HEAD>
<TITLE>Bill's-send-mail</Title>
</HEAD>
<BODY LINK="#0000ff">
<script Language="JavaScript">
<!--Hide
// function submits a form
function submitForm(form){
document.form1.submit(form);
}
// End Hide -->
</SCRIPT>
<form name="form1" method="post" action="http://www.sendfree.com/arform.cgi">
<input type="hidden" name="type" value="1">
<input type="hidden" name="id" value="39241">
<input type="hidden" name="name" value="Bill Corbett" size="40">
<input type="hidden" name="email" value=billMesg>
<input type="hidden" value="Submit" onclick = submitForm(this.form)>
</form>
<script Language="JavaScript">

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

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

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

whammy
07-26-2002, 11:53 PM
I've never tried this type of ActiveX script, but this looks like a typo:

while(!myInputTextStream.AtEndfStream){

Shouldn't that be:

while(!myInputTextStream.AtEndOfStream){

?

wwcbill
07-27-2002, 12:13 AM
Thanks Whammy,
But that is not the problem. I use DreamWeaver to step through the code. I have several e-mail addresses and none of them sre submitted.

whammy
07-27-2002, 01:17 AM
Did you try it? Like I said, I've never used an ActiveX script like that... but I would bet you $25 that's a typo... whether or not you did it or DreamWeaver (yech) did.

If it will work once you correct the mistake or not, I have no idea. :)

wwcbill
07-27-2002, 01:32 AM
Hi Whammy,
First I did correct it, and ends correctly now. Second it did not correct the problem, and third I userd DreamWeaver to try to help find the problem. This script cycles thru each e-mail and attempts send it to the designated location.

whammy
07-27-2002, 01:51 AM
Why don't you just hard code the email address into an array in javascript?

The sad thing is, stuff like this is really easy if you're using a server-side scripting language. You would be much better off doing something like that.

wwcbill
07-27-2002, 02:16 AM
Hi Again Whammy,
I don't know if this is server side or not, but I have to be able to send various e-mails from all over the place to one location. I must filter each e-mail to one location regardless as to the original senders loction. I also must receive e-mails from mamy different formats. If you know how this can be done under my control, I would gladly junk this and use what ever you recommed.

whammy
07-27-2002, 02:18 AM
It definitely sounds like you need to use the server-side scripting language of your choice, and perhaps a database (although you can use a flat file for email addresses if it's not too big!).

That enables people from "many locations" to send stuff (whatever kind of information it may be) to "one location" (your server).

Other than that, I can only really tell you to research it yourself... it's not hard to go server-side, but you have to learn it on your own.

wwcbill
07-27-2002, 02:30 AM
Thanks Whammy,
But I need to try to figures this out. Everything appears to work. I get no errors, but I do not send anything. The server responds but nothing happens. Oh well I guess I will leave it here and maybe someone can help.
Thanks for your help.

whammy
07-27-2002, 02:33 AM
// If there was not an error, then open the file and display it.
while(!myInputTextStream.AtEndfStream){
var billMesg = myInputTextStream.ReadLine();
submitForm();


I don't see anything here that actually sends an email. Only submits the form...

wwcbill
07-27-2002, 02:43 AM
Whammy,
Maybe I have the wong idea here. I thought that if I submit the form with the correct entries, it would be suffient and the server would accept the input and reply. Am I wrong.

whammy
07-27-2002, 02:44 AM
Your "server" must have a method to reply with.

wwcbill
07-27-2002, 02:46 AM
Is the post in the form not enough?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum