Click to See Complete Forum and Search --> : need help on web server...


kdraugsk
August 6th, 2002, 10:45 PM
hi there, i've made my own web server and i've put web page on it...
but i've one problem- in web page i've guestbook (you put your name, e-mail...) and then this information is sent to my e-mail... but thats the problem - i don't get this message on my e-mail :(
the guestbook is made with perl and CGI
Some guy told me that i need send mail program on my machine, but what kind of program? do i need to put mail server too???
could anybodey explain where is the problem and how can i solve it? (if i need some software - please tell me wich(the name of it) ) or give me some links where to look for answers..
thanx
kdr

dAggressor
August 6th, 2002, 10:56 PM
kdraugsk it depends on where the email is supposed to go. If you are trying to deliver it to your local machine (username@localhost.localdomain or something else that is your machine) then you need to have an smtp server and pop server running on your web server such as sendmail (www.sendmail.org) or postfix (www.postfix.org). This is assuming that you are running a linux/unix style box, if it is windows then there are other options. As long as this site is going to be a small site the best choice would be to send the emails to an internet email address such as username@hotmail.com or something like that. You can get free email accounts from almost anywhere.

However your webserver will have to have an email server or client that is allowed to send outbound emails. Without too much information as to what the cgi script is doing I can't really give you a definate answer. Try putting your server type, and the cgi script on your next post and that would be more help for those of us who are trying to help.

Hope this sheds some light on it for you.

kdraugsk
August 6th, 2002, 11:07 PM
hi again,
i'm using web server named Xitami v2.5b4 and the scrip that i'm using is:
fot HTML:
<HTML>
<HEAD>
<TITLE>Guestbook Script</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="post" ACTION="/cgi-bin/guestbook.cgi">

<INPUT NAME="name" SIZE=50 TYPE="text"> Your Name

<INPUT NAME="email" SIZE=50 TYPE="text"> Your E-Mail Address

<INPUT TYPE="hidden" NAME="submitaddress" VALUE="kdraugsk@inbox.lv">
Write to me below:


<TEXTAREA NAME="feedback" ROWS=10 COLS=50></TEXTAREA>



<CENTER>
<INPUT TYPE=submit VALUE="SEND">
<INPUT TYPE=reset VALUE="CLEAR">
</CENTER>

</FORM>
</BODY>
</HTML>

and for cgi:
#!D:/perl/bin/perl

# That is the path to PERL just above It MUST be first in the script
# The following accepts the data from the form

if ($ENV{'REQUEST_METHOD'} eq 'POST') {

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$FORM{$name} = $value;
}



# The following sends the email

open (MESSAGE,"| /usr/lib/sendmail -t");

print MESSAGE "To: $FORM{submitaddress}\n";
print MESSAGE "From: $FORM{name}\n";
print MESSAGE "Reply-To: $FORM{email}\n";

print MESSAGE "Subject: Feedback from $FORM{name} at $ENV{'REMOTE_HOST'}\n\n";
print MESSAGE "The user wrote:\n\n";
print MESSAGE "$FORM{feedback}\n";
close (MESSAGE);

&thank_you;
}




#The following creates the Thank You page display

sub thank_you {

print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Thank You!</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=#FFFFCC TEXT=#000000>\n";
print "<H1>Thank You!</H1>\n";
print "\n";
print "

\n";
print "<H3>Your feedback is greatly appreciated.
\n";
print "

\n";
print "</BODY>\n";
print "</HTML>\n";
exit(0);
}

this is an exaple shown on HTMLgoodies.com
and i'm using e-mail that is on other server (free e-mail...)
thanx for help
kdr

KissCool
August 6th, 2002, 11:14 PM
It could be more easy if your CGI script could write directly those info on your hdd. it would use less ressources and it would be a better things to secure your server (smtp server are often the first attacked).

jethro
August 7th, 2002, 12:04 AM
I agree with KissCool, just save it locally.

As for your webserver... can't you use Apache like normal folks? :D

ac1dsp3ctrum
August 7th, 2002, 12:44 AM
Yeah, Why have the information sent to you by email... And since your not on Linux you cant recieve the emails unless you have a SMTP server up =)

AngryBob
August 7th, 2002, 04:35 AM
whats your ip address? ;)

khakisrule
August 7th, 2002, 04:39 AM
2 things. First of all, xitami is a really good server, configurable, you can pick how much memory you want to allocate, works with anything, coldfusion, php etc. It has almost no known exploits. It is also free, and a small download, it has a nice GUI, and web based administration. Really good server. And as for mail, you should probably setup an smtp server, or just save the entries locally to a database. Your ISP may let you use theirs, mine did for my web hosting needs, they were pretty nice about it, ask yours.