Mail with Perl/CGI Please use speaker notes for additional information!
Mail Alumni Information Name: Year Graduated: Job: This form takes in name, year of graduation, job and and passes the information to mailtest1.cgi which is stored in the same directory as this program (mailtest1.html).
#!/usr/bin/perl print "Content-type: text/html\n\n"; use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); use Net::SMTP; use strict; my($name, $yrgrad, $job, $ , $msg, $smtpserver); $smtpserver = "mail.pgrocer.biz"; $name = param('name'); $yrgrad = param('yrgrad'); $job = param('job'); $ = param(' '); $msg = "Thank you for the information. We appreciate your continued interest in BCC."; print " \n"; print " Alumni Response \n"; print " \n"; print " CIS Alumni - Bristol Community College \n"; print " $msg \n"; print " \n";
# send my $smtpobj = new Net::SMTP( "$smtpserver) or die( "Cannot send $!" ); $smtpobj->mail( ); $smtpobj->to( "$ " ); $smtpobj->data(); $smtpobj->datasend( "From: BCC CIS Dept.\n" ); $smtpobj->datasend( "To: $ \n" ); $smtpobj->datasend( "Subject: BCC CIS Alumni\n" ); $smtpobj->datasend( "$msg\n" ); $smtpobj->dataend(); $smtpobj->quit(); Alternate: The HELLO should be invoked automatically and should not be needed with the Net:SMTP object. my $smtpobj = new Net::SMTP( "$smtpserver", HELLO => "$smtpserver" ) or die( "Cannot send $!" ); Set up an instance of the SMTP package.