Download presentation
Presentation is loading. Please wait.
Published byShannon Spencer Modified over 9 years ago
1
Mail with Perl/CGI Please use speaker notes for additional information!
2
Mail Alumni Information Name: Year Graduated: Job: email: This form takes in name, year of graduation, job and email and passes the information to mailtest1.cgi which is stored in the same directory as this program (mailtest1.html).
3
#!/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 " \n"; print " Alumni Response \n"; print " \n"; print " CIS Alumni - Bristol Community College \n"; print " $msg \n"; print " \n";
4
# 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(); 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 email: $!" ); Set up an instance of the SMTP package.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.