in reply to Sending email from a CGI script (was: sendmail)

If you're just looking for a way to get the input from the form, I'd have to suggest using the CGI.pm module. The use of modules is stressed here for good reason and I believe the CGI.pm module is fairly standard. Then you could just do something like
use CGI; $fav_color = param("favorite_color");
to get the variable input. I'd consult OVID's tutorial mentioned above for the exact usage of the CGI module.

If you really don't want to use any modules, the following code will create a hash called formdata which contains the form input as name/value pairs.
sub parse_form { my (@pairs, $buffer, $value, $key, $pair); if ($ENV{'REQUEST_METHOD'} eq 'GET') { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); } else { print "Content-type: text/html\n\n"; print "<P>Use Post or Get"; } foreach $pair (@pairs) { ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~s/<!--(.|\n)*-->//g; if ($formdata{$key}) { $formdata{$key} .= ", $value"; } else { $formdata{$key} = $value; } } return %formdata; }
You'd then call the subroutine with something like my %formdata = &parse_form

After you get the form information, using either of the above mentioned methods, you can use the sendmail program, which is standard on most any *NIX box.
open (MAIL, "|/usr/bin/sendmail -t") or die "Error"; print MAIL "To: to@address.com \nFrom: from@address.com\n"; print MAIL "Subject: mail subject\n"; print MAIL "Add the contents here\n"; close (MAIL);
Hope this helps. -Eric