Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-26-2002, 10:19 PM   PM User | #1
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
Angry E-mail help

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>
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Old 07-26-2002, 11:53 PM   PM User | #2
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
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){

?
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-27-2002, 12:13 AM   PM User | #3
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
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.
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Old 07-27-2002, 01:17 AM   PM User | #4
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
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.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-27-2002, 01:32 AM   PM User | #5
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
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.
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Old 07-27-2002, 01:51 AM   PM User | #6
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
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.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-27-2002, 02:16 AM   PM User | #7
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
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.
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Old 07-27-2002, 02:18 AM   PM User | #8
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
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.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)

Last edited by whammy; 07-27-2002 at 02:21 AM..
whammy is offline   Reply With Quote
Old 07-27-2002, 02:30 AM   PM User | #9
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
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.
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Old 07-27-2002, 02:33 AM   PM User | #10
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
Quote:
// 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...
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-27-2002, 02:43 AM   PM User | #11
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
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.
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Old 07-27-2002, 02:44 AM   PM User | #12
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
Your "server" must have a method to reply with.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-27-2002, 02:46 AM   PM User | #13
wwcbill
New to the CF scene

 
Join Date: Jul 2002
Location: Woodland Hill, Ca
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
wwcbill is an unknown quantity at this point
Is the post in the form not enough?
__________________
Bill...I will if you will and we will together.
wwcbill is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:44 AM.


Advertisement
Log in to turn off these ads.