Mailform problem???
Jeg har hentet en mailfom.cgi, og redigeret o.s.v. . Jeg udfylder felterne o.s.v. Og cgi scriptet siger at mailen er blevet sendt, MEN mailen kommer aldrig frem???Her er scriptet:
#!/usr/local/bin/perl
#
######################################################################
# A&M MailForm Version 1.2
# Copyright 1999 Alex Iatskovski 74642.3600@compuserve.com
# Created 06/10/99
# Last Modified 06/15/99
# Home URL http://www.anmweb.com
#
######################################################################
#
# This is a MailForm program that allows you to communicate with the
# visitors of your home page without publishing your E-mail address on
# the Web. Your real E-mail address is completely hidden from spammers
# (it is not shown in web-page source in contrast to most such programs),
# but at the same time you are not losing ability to communicate with
# a civilized visitors of your Web Site. This program is using Java Script
# to display form in a nice popup window. But it works as well if Java Script
# is disabled in visitor's browser. It will work with all known Web Browsers.
# No more HTML forms programming! This script is generating all necessary
# forms dynamically on the fly.
#
######################################################################
#
# Installation:
#
# Put this script into your cgi-bin directory and make it executable
# (chmod 755 on most system). Then change variables according to your
# requirements.
#
# 1. Make sure the very top line of script is pointed to the exact location
# of Perl program on your server.
#
# 2. Make sure the "$mailprog" variable is pointed to the exact location of
# "sendmail" program on your server.
#
# 3. Make sure to change "$admin_mail" variable to your real E-mal address.
#
# 4. Make sure the "$cgiurl" variable is pointed to the exact URL of
# your script.
#
# To call this program from the Web pages use something like this:
#
# ----------Cut here----------
# <a href="/cgi-bin/mailform.cgi" target="NewWindow"
# onclick="window.open('/cgi-bin/mailform.cgi','newWindow','toolbar=0,
# location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,
# width=500,height=420');return false"><strong>Contact Us</strong></a>
# ----------End of cut----------
#
# IMPORTANT! This whole HTML link should be written in ONE LINE! Otherwise
# the Java Script will not work. Make sure also that the "/cgi-bin/mailform.cgi"
# part is pointed to the real location of the script. If not, you should change
# it (two times!) in above example and put it to your HTML page.This construction
# will work even with Java Script disabled browsers.
#
# That's all! Your program is now up and running.
#
######################################################################
#
# COPYRIGHT NOTICE
# (c)Copyright 1999 Alex Iatskovski All Rights Reserved.
#
# A&M Register program is FREEWARE BUT IT IS NOT PUBLIC DOMAIN! This
# program may be used free of charge by anyone so long as this copyright
# notice and the comments above remain intact. Any modification to this
# program except configuration user variables is strictly prohibited!
# By using this code you agree to indemnify A.Iatskovski from any liability
# that might arise from its use.
#
# Selling the code for this program without prior written consent
# is expressly forbidden. In other words, please ask first before
# you try and make money off of my program.
#
# Obtain permission before redistributing this software over the
# Internet or in any other medium. In all cases copyright and header
# must remain intact.
#
######################################################################
# Perl's use strict directive checks to make sure variables are
# declared before use. It's a handy check to make sure you are doing
# what you think you are doing. Always
use strict;
# Make sure your Perl version is not earlier than this one
require 5.003;
######################################################################
# Define Variables
# Mail program path
my ($mailprog) = 'smtp.wol.dk';
# Admin E-mail
my ($admin_mail) = 'zyberdog@hotmail.com';
# CGI URL
my ($cgiurl) = 'mailform.cgi';
# Global Vars, don't change!
my ($buffer, @pairs, $pair, $name, $value, %FORM);
# Done
######################################################################
###################################
### Do not edit below this line ###
###################################
# Antihacker's rooting
if ($ENV{'QUERY_STRING'} ne '') {
my ($text) = <<EOT;
To be a hacker indicates to be a man with more than just one cerebral bend.
What do you attempt to do here boy? These tries do not roll on this server!
If you have something to say - speak up, if not - get lost and say your mother
that your stupid attempt to hack this Web Site was logged by server's security staff.
EOT
&error($text);
}
else {
&parse_form();
}
if ($FORM{'action'} eq 'send_form') {
&check_form();
&mail_form();
&show_thanks();
}
else {
&main_form();
}
###############
sub parse_form {
###############
# Read in text
$ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
if ($ENV{'REQUEST_METHOD'} eq "POST"){
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
else {
$buffer = $ENV{'QUERY_STRING'};
}
# Split information into name/value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%(..)/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
##############
sub main_form {
##############
my $title = 'Tryout';
my $text = <<EOF;
<FORM ACTION="$cgiurl" METHOD="POST">
<INPUT TYPE="text" SIZE="30" NAME="realname" VALUE="Dit navn" MAXLENGTH="30">
<BR><BR>
<INPUT TYPE="text" SIZE="30" NAME="email" VALUE="Din E-mail" MAXLENGTH="30">
<BR><BR>
<INPUT TYPE="text" SIZE="30" NAME="subject" VALUE="Emne" MAXLENGTH="30">
<BR><BR>
<TEXTAREA NAME="body" ROWS="5" COLS="50">Feedback, ansøgning m.m.</TEXTAREA>
<BR><BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Send">
<INPUT TYPE="reset" NAME="Button" VALUE="Slet">
<input type=hidden name="action" value="send_form">
</FORM>
EOF
&show_form($title,$text);
}
###############
sub check_form {
###############
if($FORM{'realname'} eq "Your name"){
&error('Du glemte at skrive dit navn!');
}
elsif($FORM{'realname'} eq ""){
&error('Du glemte at skrive dit navn!');
}
elsif(!($FORM{'email'} =~ /([\w-.]+\@[\w-.]+)/)){
&error('Du glemte at skrive din E-mail addresse!');
}
elsif($FORM{'subject'} eq "Subject"){
&error('Du glemte at skrive et emne!');
}
elsif($FORM{'subject'} eq ""){
&error('Du glemte at skrive et emne!');
}
elsif($FORM{'body'} eq "Type your text here"){
&error('Du glemte at skrive en meddelse!');
}
elsif($FORM{'body'} eq ""){
&error('Du glemte at skrive en meddelse!');
}
}
##############
sub mail_form {
##############
my $text = <<EOF;
Administrator of this server forgot to enter his E-mail
address to this program! I can't continue without correct
E-mail address of the site administrator.
EOF
if ($admin_mail eq '^zyberdog@hotmail.com'){&error($text);}
open(MAIL,"|$mailprog -t");
print MAIL "To: $admin_mail\n";
print MAIL "From: $FORM{'email'} ($FORM{'realname'})\n";
print MAIL "Subject: $FORM{'subject'}\n";
print MAIL "X-Priority: 1 (Highest)\n\n";
print MAIL "#\n";
print MAIL "# Entered from $ENV{'REMOTE_HOST'} ($ENV{'REMOTE_ADDR'}) with $ENV{'SERVER_PROTOCOL'}.\n";
print MAIL "#\n\n";
print MAIL "$FORM{'body'}\n";
close(MAIL);
}
################
sub show_thanks {
################
my $title = 'Mailform udfyldt korrekt!';
my $text = <<EOF;
<small>Dine informationer er blevet sendt til webmaster.</small><br>
<h1><b>Tak!</b></h1>
EOF
&show_form($title,$text);
}
###################################
# Sub Error
# Usage - &error('Your text here');
###################################
sub error {
my $title = 'Fejl';
my $text1 = $_[0];
my $text = <<EOF;
<small>Mailformen kunne ikke udføres. Dette var fordi:</small>
<br><br>
<small><b>$text1</b></small><br><br>
<small>Klik <a href="$cgiurl"><font color="#0000FF">her</font></a> for at starte forfra.</small>
EOF
&show_form($title,$text);
}
###################################
# Sub main_form
# Usage - &show_form($title,$text);
###################################
sub show_form {
print "Content-type:text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html\;\n";
print "charset=iso-8859-1\">\n";
print "<meta name=\"robots\" content=\"noindex\">\n";
print "<title>$_[0]</title>\n";
print "</head>\n";
print "<body bgcolor=\"#000000\">\n";
print "<div align=\"center\">\n";
print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"\n";
print "bgcolor=\"#000000\">\n";
print "<tr><th align=\"center\" colspan=\"3\" width=\"100%\" bgcolor=\"#000000\"\n";
print "nowrap>\n";
print "<font color=\"#FF0000\" size=\"6\">\n";
print "\ \;$_[0]\n";
print "</font>\n";
print "</th>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"10%\">\ \;</td>\n";
print "<td width=\"80%\">\ \;</td>\n";
print "<td width=\"10%\">\ \;</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"10%\">\ \;</td>\n";
print "<td width=\"80%\">$_[1]</td>\n";
print "<td width=\"10%\">\ \;</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"10%\">\ \;</td>\n";
print "<td width=\"80%\">\ \;</td>\n";
print "<td width=\"10%\">\ \;</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<th align=\"center\" colspan=\"3\" width=\"100%\" bgcolor=\"#000000\"\n";
print "nowrap>\n";
print "<small><font color=\"#FFCC33\">\n";
print "</font></small></a>\ \;\n";
print "</th>\n";
print "</tr>\n";
print "</table>\n";
print "</div>\n";
print "</body>\n";
print "</html>\n";
exit (0);
}
#####################
### END OF SCRIPT ###
#####################
Hjælp ....
