#!/usr/bin/perl -w # This turns on warnings use strict; # This pragma will help you avoid common mistakes by enforcing commonly accepted "good" coding techniques use CGI; # This will allow you to redirect your web page once you send the email use CGI::Carp qw(fatalsToBrowser); # This will put any fatal errors to your web page instead of to the normal error log use Mail::Mailer; # This will allow you to send the email my $query = CGI->new(); # This creates a new CGI object. The redirect method will come after we have sent the mail. my %DATA = $query->Vars; # This uses a method on the CGI object to stick all the form values into the DATA hash for you my $mailer = new Mail::Mailer ( "smtp" ); $mailer->open( { To => 'info@travancoresch.vic.edu.au', From => $DATA{Email}, Subject => 'Travancore School Professional Development' } ); # This will create a new object that we will use to send the email print $mailer "$DATA{Att1}\n"; print $mailer "$DATA{Att2}\n"; print $mailer "$DATA{Att3}\n"; # This will print to the email $mailer which is a file handle created for you when you create the object. $mailer->close; # This sends the email print $query->redirect('http://www.travancoresch.vic.edu.au/development/reply02.html'); # This redirects the web page to the new desired location