#!/usr/bin/perl use CGI qw(:cgi-lib :standard); &ReadParse(); print "Content-type: text/html\n\n"; my $dispform = 1; $errors = ""; if ($in{'formsent'} eq "yes") { # Form Validation if ($in{'name'} eq "") { $errors .= "Please enter your name
"; } if ($in{'email'} !~ /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/) { $errors .= "Please enter a valid email address
"; } if ($in{'recipe'} eq "") { $errors .= "Please enter your Recipe Name
"; } if ($in{'ingredients'} eq "") { $errors .= "Please enter your Ingredients
"; } if ($in{'instructions'} eq "") { $errors .= "Please enter your Cooking Instructions
"; } if ($errors eq "") { $dispform = 0; use MIME::Lite; use Net::SMTP; ### Get list of data passed in from function call my $to_address = 'info@oscarwareinc.com'; my $from_address = $in{'email'}; my $subject = "Oscarware Recipe Sumbmitted"; ### Modify the email message to make it look nicer my $emailmsg = "Name: $in{'name'}
Email: $in{'email'}
Recipe Name: $in{'recipe'}

". "Ingredients:
$in{'ingredients'}
Cooking Instructions:
$in{'instructions'}"; ### Create the multipart container my $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart container: $!\n"; ### Add the text message part $msg->attach ( Type => 'text/html', Data => $emailmsg ) or die "Error adding the text message part: $!\n"; ### Send the Message MIME::Lite->send('sendmail', $mail_host, Timeout=>60); $msg->send; } } print < Oscarware Inc. - News & Events
Cook Out

Send us your favorite recipes!

EOT if ($dispform == 1) { print <

Use the form below to send us your favorite recipes, and it could be included here on our website!

Name:
Email Address:
Recipe Name:
Recipe
Ingredients:
Cooking/Prep
Instructions:

$errors

EOT } else { print <

Thank you for submitting your recipe.








EOT } print <


Check out the other recipes available!
EOT exit;