Sending Email From A CGI Script
#!/usr/bin/perl -w

use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
use Mail::Sendmail;

print header(), start_html("Email Demo");


print h1("Please enter your message in the area supplied below:");
if (param("Send Email"))
{
    $email = param("Send Email");
    $to    = param("to");
    $from  = param("from");
    sendmail(To => $to, From => $from, Message => param("email")) or
        die "$Mail::Sendmail::error";
}


print start_form(); 
print p("Your Email Address",
         textfield(-name => "from", -size => 72));
print p("Recipient Email Addresses", 
         textfield(-name => "to", -size => 72));
print p("Your message: ",
     textarea(-name => "email", -rows => 10, -cols => 72, -wrap => "physical")); 

# Submit creates a button!!
print p(submit(-name => 'Send Email')),
      end_form, end_html;