I'm trying to use sendmail to send the contents of a webform to email. The script I've written gets the parameters from the webform (via post) and it does send the email but it always ends with an error. Here's a stripped-down version of my best try, it ends with an error about my use of Email::Sender::Success->success.
The "success" page is never displayed, if I could I'd like to also have a "failure" page.
use strict;
use warnings;
use CGI qw( :standard );
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use Email::Simple;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Success;
use Email::Simple::Creator;
my $sender = param('Name');
my $sndr_email = param('Email');
my $sire1 = param('Sire1');
my $dam1 = param('Dam1');
my $sire2 = param('Sire2');
my $dam2 = param('Dam2');
my $rcp_email = "email\@gmail.com";
my $subject = "Mating";
my $message = "Combination 1:\nSire: $sire1\nDam: $dam1\n\nCombination
+2:\nSire: $sire2\nDam: $dam2\n";
my $email = Email::Simple->create(
header => [ From => "$sndr_email", To => "$rcp_email", Subject => "$
+subject" ],
body => $message,
);
sendmail($email);
if (my $success = Email::Sender::Success->success) { #this is wrong
print "Content-type: text/html\n\n";
#the page is never seen
print << 'EOF';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/
+/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1
+" />
<title>Title</title>
<link rel="stylesheet" type="text/css"
href="cgistyle3.css" />
</head>
<body>
<div id="banner"><div id="links">
<a href="http://localhost/entrance/index.html">home</a>
<a href="http://localhost/entrance/search.pl">search</a>
</div></div>
<hr />
<h3>The form has been sent!</h3>
</body>
</html>
EOF
}
1;