#!/usr/bin/perl -wT use strict; use CGI qw/:standard/; $ENV{'PATH'}=''; my $q = new CGI; my $_mail_from = $q->param("mailfrom"); my $msg = $q->param("msg"); my ($mail_from) = defined ($_mail_from) =~ /^(\w+\@\w+\.\w+)$/; if($mail_from && $msg) { &send_message($mail_from,$msg); &display_thanks; } else { &display_form } sub send_message { my ($message1, $message2) = @_; my $email = "zacko\@localhost"; open (SENDMAIL, "|/usr/lib/sendmail -t -oi"); print SENDMAIL <header({-title=>"zacko"}), $q->start_html({title=>"Contact Us"}), $q->p($message), $q->p("Send your questions here"), start_form({action => "mail.pl", enctype => "application/x-www-form-urlencoded", method => "post"}), p("Your Mail Address", $q->input({maxlength=>"30",name=>"mailfrom", size=>"30", type=>"text"})), p($q->textarea(-name=>"msg",-override=>1, -rows=>10,-cols=>30)), p($q->input({type=>"submit",value=>"Send"})), p($q->input({type=>"reset"})), $q->end_form, $q->end_html; } sub display_thanks { print $q->header, $q->start_html, $q->p("Thanks for your mail"), $q->end_html; } #### my ($mail_from) = defined ($_mail_from) =~ /^(\w+\@\w+\.\w+)$/;