mailtest1.html

 

<html>

<head><title>Mail</title></mail>

<body>

<h1>Alumni Information</h1>

<form action="mailtest1.cgi" method=post>

Name: <input type=text name=name size=25><br><br>

Year Graduated: <input type=text name=yrgrad size=4><br><br>

Job: <input type=text name=job size=35><br><br>

email: <input type=text name=email size=35><br><br>

<input type=submit value="Submit">

<input type=reset value="Reset">

</form></body></html>

 

mailtest1.cgi

 

#!/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, $email, $msg, $smtpserver);

$smtpserver = "mail.pgrocer.biz";

$name = param('name');

$yrgrad = param('yrgrad');

$job = param('job');

$email = param('email');

$msg = "Thank you for the information. We appreciate your continued interest in BCC.";

print "<html>\n";

print "<head><title>Alumni Response</title></head>\n";

print "<body>\n";

print "<h1>CIS Alumni - Bristol Community College</h1>\n";

print "<h2>$msg</h2>\n";

print "</body></html>\n";

 

# send email

 

my $smtpobj = new Net::SMTP( "$smtpserver")

or die( "Cannot send email: $!" );

 

$smtpobj->mail( "pgrocer\@pgrocer.biz" );

$smtpobj->to( "$email" );

$smtpobj->data();

$smtpobj->datasend( "From: BCC CIS Dept.\n" );

$smtpobj->datasend( "To: $email\n" );

$smtpobj->datasend( "Subject: BCC CIS Alumni\n" );

$smtpobj->datasend( "$msg\n" );

$smtpobj->dataend();

$smtpobj->quit();