My cgi's run great, but why no form feed back?

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
User
-


Joined: 07 Sep 2003
Posts: 2

PostPosted: Sun Sep 07, 2003 9:06 am    Post subject: My cgi's run great, but why no form feed back? Reply with quote

I have just installed abyss web server and I love it. I finnaly got all of my cgi's to run but I still have one problem. On one of my pages, I have a form for people to put their information and have a cgi script that is supposed to send the info via email. All looks great online. It even tells me that I the info was sent. But when I check my email account it not there. Could someone please help me out.
_________________
spider vain
Back to top View user's profile Send private message
os17fan
-


Joined: 21 Mar 2003
Posts: 531
Location: USA

PostPosted: Sun Sep 07, 2003 6:17 pm    Post subject: Reply with quote

I heard that when you run a cgi form mailer script that you have to havea SMTP mailer or some kind of program installed. I forgot what its called 8)
_________________
This web server is the best !
Back to top View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Sep 08, 2003 11:33 pm    Post subject: Re: My cgi's run great, but why no form feed back? Reply with quote

User,

Can you copy/paste here the script that send the emails if not too long or give us an URL from where it can be downloaded? This will help us know how this script sends mails.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
User
-


Joined: 07 Sep 2003
Posts: 2

PostPosted: Tue Sep 09, 2003 3:43 am    Post subject: Reply with quote

Here is the script. I am running on Win 98... I have put lines where I am not sure what to put.


## Method used to send e-mail
## sendmail - Through Sendmail, hosted on a UNIX / LINUX server (recommended)
## smtp - Through a SMTP mail server. Only if hosted on a Windows server
$mailtype = '---------------------';
#$mailtype = 'mail.compuserve.com';

## Location of mail program.
## If sendmail, the full path on your web server to Sendmail
## If smtp, the host name of your mail server (eg. mail.domain.com)
$mailprog = '-----------------';
#$mailprog = 'mail.domain.com';

## Perform a referer check? (1 = Yes. 0 = No)
## You may want to leave this off, because if turned on, people using a firewall
## may receive an error message
$referer_check = 0;

## The three referers of your domain name
@referers = ("mysite.com", "www.mysite.com",----------------");

## Print HTML header
print "Content-type: text/html\n\n";

## Check referers
&check_referers if $referer_check == 1;

## Parse HTML form
&parse_form;

## Get started
&get_started;

## Prepare message(s)
&prepare_message;

## Send e-mail message(s)
&send_message;

## Save results to text file
&save_results if $proc{'results_file'};

## Finish up
&finish_up;

## Exit
exit(0);

################################################
## Check referers
################################################

sub check_referers {

## Check referer
my $ok=0;
foreach (@referrers) { $ok = 1 if $ENV{'HTTP_REFERER'} =~ /^https*:\/\/$_/i; }

## Perform check
&error("Invalid referrer") if $ok != 1;

## Return
return 1;

}

################################################
## Parse the form
################################################

sub parse_form {

## Parse form, with file attachments
if ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) {
my ($cgi, @names);

## Load CGI.pm module
eval { require CGI; };
if ($@) { &error("Unable to load required Perl module, <b>CGI.pm</b>"); }

## Initialize CGI.pm instance
$cgi = new CGI;
@names = $cgi->param;

## Parse form contents
foreach $name (@names) { $in{$name} = $cgi->param($name); }

## Parse normal HTML form
} else {

## Read STDIN into $buffer
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
my @pairs = split /&/, $buffer;

## Parse form contents
foreach $pair (@pairs) {
my ($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($in{$name}) { $in{$name} .= " , " . $value; }
else { $in{$name} = $value; }
}
}

## Format all form fields into lowercase
while (($key, $value) = each %in) {
$key = lc($key);
$in{$key} = $value;
}

## Return
return 1;

}

Anyway this is not all of it but I think it will give you an idea of how it works. Hope you can help. Thanks ....
_________________
spider vain
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Sep 10, 2003 3:31 pm    Post subject: Reply with quote

You should modify the script according to the comments in its first lines:

Code:
## Method used to send e-mail
##    sendmail - Through Sendmail, hosted on a UNIX / LINUX server (recommended)
##    smtp     - Through a SMTP mail server.  Only if hosted on a Windows server
$mailtype = 'smtp';

## Location of mail program.
## If sendmail, the full path on your web server to Sendmail
## If smtp, the host name of your mail server (eg. mail.domain.com)
$mailprog = 'smtp.yourisp.com';


Notice that $mailprog should be set to the SMTP server of your ISP (the one you use to send mail with your email client such as Outlook).
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group