Am Samstag, 4. Juni 2005 08.38 schrieb Anish Kumar K: > This is the program I am using for SENDMAIL. Surprisingly it is not dying.
It even does not compile. > I could see an error message in the browser as "The System cannot find the > path specified". I donno from where the message is coming.. > I removed the SENDMAIL part and then checked, now the error is not > coming....I am sure it is with the sendmail. Is it some thing to do with > the sendmail. > > Any other module which will accomplisj the task.... For example (code snippet) use Mail::Send; my $msg = new Mail::Send ( Subject=>$subject, To=>$email ) or die $!; #$msg->set('Reply-To', $Reply_to); $msg->set('Bcc', $Bcc); $msg->set('From', $From); # The filehandle returned is an instance of the Mail::Mailer class. my $fh = $msg->open; print $fh <<EOF; Mail body EOF $fh->close or die; # complete the message and send it see search.cpan.org for the Mail::Send Module. > #!/usr/local/bin/perl > use strict; > use warnings; > use CGI; > > my $cgi=new CGI; > print $cgi->header(); > my $name = &clean($cgi->param('name')); // THIS IS FROM THE html FILE > my $age = &clean($cgi->param('age')); // THIS IS FROM THE html FILE $name and $age could be better sanitized: age should only contain numbers, and name not all chars, no line breaks etc. Also try to set a default value to avoid warnings about undefined variables: my $age=$cgi->param('age') || '0'; # or whatever # TODO: sanitize "//" is not the way to comment in perl, gives syntax error. > my $sendmail = "/usr/sbin/sendmail -t"; > my $reply_to = "Reply-to: [EMAIL PROTECTED]"; > my $subject = "Subject: Confirmation of your submission"; > my $content = "Thanks for your submission."; > my $to = "[EMAIL PROTECTED]"; > > unless ($to) { > print $cgi->header; The header has already been printed above. > print "Please fill in your email and try again"; After that, the program continues... > } > > open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!"; > print SENDMAIL $reply_to; > print SENDMAIL $subject; > print SENDMAIL $to; > print SENDMAIL "Content-type: text/plain\n\n"; > print SENDMAIL $name; > print SENDMAIL $description; $description is not defined. > close(SENDMAIL); This could fail. > print $cgi->header; The header is printed the 3rd time?!? > print "Confirmation of your submission will be emailed to you."; Not sure. The sending could have failed. > sub clean > { > # Clean up any leading and trailing whitespace > # using regular expressions. > my $s = shift @_; > $s =~ s/^\s+//; > $s =~ s/\s+$//; > return $s; > } joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>