What is the area on a Perl form that is considered the static portion? My form is below. I need to add text after the static portion. Thank you.
#!c:/perl/bin/Perl.exe
##
## emailFormData.pl -- Sends form data to email recipient(s) listed in hidden
form field emailto
## Expects to
receive two form params: formname, emailto
## formname
- self explanatory, the name of the form
## emailto
- a comma separated list of email addresses
##
can be as little as one or multiple email addresses
##
examples:
##
SomeEmail@somedomain
##
SomeEmail@somedomain.com,SomeEmail@somedomain.com
##
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Net::SMTP;
my $query = new CGI;
my $formname = param('formname');
my $emailfrom = param('emailfrom');
my $emailto = param('emailto');
my $emailsubject = param('emailsubject');
my $print_debug_info = 'no';
my $sendEmail = 'yes';
my $error_message = '';
my $error = 0;
my ($var, $name, $value, $val);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isd st) = localtime(time);
$year = $year + 1900;
$mon = $mon + 1;
my $today_date = $mon.'/'.$mday.'/'.$year;
my $ampm = ' am';
if ($hour > 12) {
$hour = $hour - 12;
$ampm = ' pm';
}
my $today_time;
if ($min < 10) {
$today_time = $hour.':0'.$min.$ampm;
} else {
$today_time = $hour.':'.$min.$ampm;
}
my @keywords = $query->keywords;
my @names = $query->param;
print $query->header(-expires=>'now');
print $query->start_html(-title=>'Email Form Data');
my $emailText = '';
my $displayText = '<b>requestor_IP : </b>'.$ENV{'REMOTE_ADDR'}.'<br>'.
'<b>script_name :
</b>'.$ENV{SCRIPT_NAME}.'<br>';
my $kntr = 0;
foreach my $name (@names) {
if ( lc($name) ne 'submit' ) {
if ( lc(param($name)) eq 'checkbox') {
$emailText .= $name.': CHECKED'."\n";
$displayText .= '<b>'.$name.'</b>:
'.param($name).'<br>';
} else {
$emailText .= $name.': '.param($name)."\n";
$displayText .= '<b>'.$name.'</b>:
'.param($name).'<br>';
}
}
$kntr++;
}
$emailText =~ s/_/ /g; ## Replace underscores with spaces
$displayText =~ s/_/ /g; ## Replace underscores with spaces
$emailText =~ s/checkbox/Yes/g; ## Replace word checkbox with Yes
$displayText =~ s/checkbox/Yes/g; ## Replace word checkbox with Yes
if ( $print_debug_info eq 'yes' ) {
print $query->Dump;
print '<h4>'.$displayText.'</h4>';
}
my @distList = split(",", $emailto );
if ( $sendEmail eq 'yes' ) {
foreach my $sendTo ( @distList ) {
#print "<h4> email sent to $sendTo".'</h4>';
Send_Email($emailfrom, $sendTo, $emailsubject, $emailText);
}
print qq!<h4>
Thank you.<br>
Your request has been submitted and a
Teambuildinginc.com
consultant will contact you within 2 business
days to provide you with a proposal based on your situation and needs. <br>
To return to the Teambuildinginc.com site: <a
href="http://www.teambuildinginc.com">Click Here</a> </h4>!;
}
print $query->end_html;
exit;
###########################################
sub Send_Email() {
my ($MailFrom, $MailTo, $Subject, $Body, $ServerName) = ( @_ );
my $testonly = 1;
if ($MailFrom eq '') { $MailFrom = 'inquire@teambuildinginc.com'; }
if ($MailTo eq '') { $MailTo = 'inquire@teambuildinginc.com'; }
if ($Subject eq '') { $Subject = "Subject"; }
if ($Body eq '') { $Body = "Body"; }
if ($testonly == 1) {
$Subject = $Subject;
}
if ($ServerName eq '') { $ServerName = "localhost"; }
# Create a new SMTP object
my $smtp = Net::SMTP->new($ServerName);
# If you can't connect, don't proceed with the rest of the script
die "Couldn't connect to server" unless $smtp;
$smtp->mail( $MailFrom );
$smtp->to( $MailTo );
$smtp->data();
# Send the header
# This address will appear in the message
$smtp->datasend('To: '.$MailTo."\n");
# So will this one
$smtp->datasend('From: '.$MailFrom."\n");
$smtp->datasend("Subject: $Subject\n");
$smtp->datasend("\n");
# Send the Body.
$smtp->datasend("$Body\n\n");
# Send the termination string
$smtp->dataend();
# Close the connection
$smtp->quit();
}


Reply With Quote

Bookmarks