Microsoft IIS
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationMicrosoft IIS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 2nd, 2004, 12:25 PM
crispyty crispyty is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 19 crispyty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
cgi error

I have a form created with html and the result will be emailed to a specific address. It works fine if when I put it on my workstation at work (both the script and the form were in the same directory), but once I put in on the server in separete folders (html form in brcf directory and the script is in cgi-bin) I will get an error, it is looking for the SEND_MAIL. Here is the script I use. I just got this off the internet. And I am using ActivePerl from ActiveState.

#!/usr/bin/perl
# A general purpose form decoder for use with all forms.
#
# what it does is accept any information from ANY HTML form
# formats it, and mails it.
#
# To operate properly, the form must have the following
# entries:
# <INPUT TYPE="hidden" NAME="FORM_NAME" VALUE="The Name of your form">
# <INPUT TYPE="hidden" NAME="MAIL_TO" VALUE="person@to-get.mail.com">
# This way the person receiving the mail knows where it came from
# The MAIL_TO is the person you want to receive the submission
#
# 1997 by bruce gronich for the public domain.
#This program is intended to be used as a learning tool. It
#is given freely AS IS and comes with no warranty. The author
#is not responsible for any damages caused by its use or
#misuse.
#cp the funform.html to your html root directory.
#modify the funform.html to meet your needs.
#change the name of the path of the /cgi-bin/ if needed
#BNB SAYS- Configure this to your sendmail
$mail_program="/usr/lib/sendmail -t ";
#BNB SAYS- Set these options to meet your needs
#let SEND_MAIL="Y" when you are done testing and want mail to be sent
$SEND_MAIL="N";
################################################## ####################
###### THIS IS WHERE OUR PROGRAM STARTS! #############################
################################################## ####################
#This first part of the program splits up our data and gets it
#ready for formatting and mailing.
$i=0;
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
$i++;
$item{$i}=$key;
$response{$i}=$content;
}
#Re-assign a couple of variables for readability reasons
$send_to = $fields{MAIL_TO};
$form_id = $fields{FORM_NAME};
$msg_from = $fields{E_MAIL};

#Set up our HTML Result Form
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Information submission result</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=#FFFFFF LINK=#4133EF ALINK=FF0000 VLINK=#FF0000>\n";
print "<CENTER>\n";
if ($SEND_MAIL eq "Y")
{
open (MAIL, "|$mail_program") ||
die "Unable to run mail program\n";
print MAIL <<__STOP_OF_HEADER__;
To: $send_to
From: $msg_from
Subject: $form_id RESPONSE
__STOP_OF_HEADER__
}
print "<H1>Your Request has been Submitted!</H1>\n";
print "<A HREF=$ENV{'HTTP_REFERER'}>\n";
print "<B>CLICK HERE!</B></A> To return to the previous page<P>\n";
print "</CENTER>\n";
print "<B>Here is the information you sent:</B><P>\n";
print "<PRE>";
print "<HR>\n";
print " SUBMISSION FORM: $form_id\n";
print " E-MAIL TARGET: $send_to\n";
print "<HR>\n";
$i=1;
while ( $item{$i} gt " ")
{
if ($SEND_MAIL eq "Y")
{
print MAIL " $item{$i}: $response{$i}\n";
}
print " $item{$i}: $response{$i}\n";
$i++;
}
print "</PRE>";
print "<HR>\n";
print "</BODY>\n";
print "</HTML>\n";
#CLOSE THE MAIL PROGRAM IF WE ARE MAILING
if ($SEND_MAIL eq "Y")
{
close (MAIL);
}
################################################## ####################
###### THIS IS WHERE OUR PROGRAM ENDS! ###############################
################################################## ####################

Reply With Quote
  #2  
Old November 2nd, 2004, 02:22 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
I have no idea how you configure ActivePerl to send mail, sorry. Try looking on their support site maybe?
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old November 2nd, 2004, 04:22 PM
crispyty crispyty is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 19 crispyty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Net::SMTP

okay, I know that I can use Net::SMTP, but I am not sure if I have it right. This is what I have so far, so do I save this as .pl or .cgi? Or does not matter? And in my form I am not asking for the sender's email address, is it okay if I just delete that line? If I have to keep how would I get the sender's email from the form? Also, how do I insert the form result into this script? Sorry, I am very new to this. I have no idea what to do.

use Net::SMTP;
$smtp = Net::SMTP->new('here.com'); # connect to an SMTP server
$smtp->mail( 'mail@mail.com' ); # use the sender's address here
$smtp->to('mail@mail.com'); # recipient's address
$smtp->data(); # Start the mail
# Send the header.
$smtp->datasend("To: user@there.com\n");
$smtp->datasend("From: user@here.com\n");
$smtp->datasend("Subject: RCF Result");
$smtp->datasend("\n");
# Send the body.
$smtp->datasend("Hello, World!\n");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection


Quote:
Originally Posted by Doug G
I have no idea how you configure ActivePerl to send mail, sorry. Try looking on their support site maybe?

Reply With Quote
  #4  
Old November 3rd, 2004, 12:48 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
I'm sorry, I don't know Perl or cgi myself. Hopefully someone who does will jump in.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationMicrosoft IIS > cgi error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT