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!

Using system in IIS5.0 on 2000 Server

Status
Not open for further replies.

luckydexte

Programmer
Apr 26, 2001
84
US
Hello All,

I am running into a problem using a Windows 2000 server running IIS 5.0. The following code works when it is run from a Perl program run at the command line but not run over the Internet.

## Start of code

$to = "brandon\@email.com";
$from = "server\@email.com";
$exe = "e:/clemail/cscript.exe";
$source = "e:/clemail/commandlineemail.vbs";
$subject = "Subject";
$file = "e:/client_webs/test.pl";

system("(\"$exe\" \"$source\" \"$to\" \"$from\" \"\" \"$subject\" \"$file\")");

## End of code

The program commandlineemail.vbs is a Microsoft program that sends an email. I have copied cscript.exe from the System32 directory so there were not permission problems. Any help would be greatly appreciated.

Cheers,

Brandon
This .vbs program is a Microsoft
 
Any errors? Perfection in engineering does not happen when there is nothing more to add. Rather it happens when there is nothing more to take away.
 
No errors, the perl program runs but no email is ever sent.
 
whats the directory/drive of this script on the net ?
if im guessing right u r supose to call cscript.exe
like this ?

E:/clemail/>( "cscript.exe" "e:/clemail/commandlineemail.vbs" "brandon@email.com" "server@email.com" "Subject" "e:/client_webs/test.pl")

?? cause this what u do with your system call here ...

if u r not in same directory use some thing like this
system('e:');
system('cd clemail');
# your system here

again your cgi should return something to the browser
at least a
print &quot;Content-type: text/html\n\n<html></html>&quot;;

using the -w help also has strict so your script should be
something like this

#!perl -w
use strict;
my $to = &quot;brandon\@email.com&quot;;
my $from = &quot;server\@email.com&quot;;
my $exe = &quot;cscript.exe&quot;;
my $source = &quot;commandlineemail.vbs&quot;;
my $subject = &quot;Subject&quot;;
my $file = &quot;e:/client_webs/test.pl&quot;;

system('E:'); # make sure your in the good drive
system('cd clemail'); # go to exe directory

system($exe . &quot; &quot; . $source . &quot; &quot; . $to . &quot; &quot; . $from . &quot; &quot; . $subject . &quot; &quot; . $file);
# this last system call will do :
# E:clemail>cscript.exe commandlineemail.vbs brandon@email.com server@email.com Subject e:/client_webs/test.pl
# then we return some html to the browser
print &quot;Content-type: text/html\n\n<html></html>&quot;;
# all done then quit
exit;
# be sure to copy this to a text editor to view a meaned to
# hope this helps ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Ok, I got the script to work by using what you suggested (with some minor alterations) but I am getting the following error when I try to run cscript.exe from a browser:

CScript Error: Loading your settings failed. (Access is denied. )

Also, I had to change my Path back to the original settings to get cscript.exe to run at all. This was no problem of course, I was just surprised I had to do so. Thanks again.

Brandon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top