I have coded a PERL script to send email to a sales rep. with customer catalog order and US Mailing information.
The customer selects to receive any of several catalogs at current online Web site Order Form.
Based on the customer's inputted zip code, a specific sales rep. will get this personal and catlog order information via email message.
I cannot get "print SENDMAIL" to write all catalog selections from @CATALOG array.
Can anyone offer assistance?
#!/usr/bin/perl
######################################
# Harvest Group Marketing Associates #
# Catalog Order Script #
######################################
#
# Create the CGI Object
#
use CGI;
my $q = new CGI;
#
# Output the HTTP Header
#
print "Content-type:text/html\n\n";
######################################
# Set up the variables #
######################################
@CATALOG = $q->param('Catalog');
$name = $q->param('Name');
$company = $q->param('Title');
$email1 = $q->param('Email');
$cc = $q->param('cc_mail');
my $zip = $q->param('Zip');
my $recipient = zipmail($zip);
my $sendmailpath = "/usr/sbin/sendmail -t";
my $subject = "Catalog Order Request";
###################################
# Match User Zip Codes to get $recipient e-mail
###################################
sub zipmail($) {
if($zip == '17705') {$recipient="tom_fitzsimmons\@micro-link.net";}
elsif(($zip >='17701') && ($zip <= '17799')) {$recipient="cookies\@micro-link.net";}
else {$recipient="mikeshaf\@ptd.net";}
}
####################################################
# Send email to customer to confirm Catalog Order #
####################################################
open(SENDMAIL, "¦$sendmailpath" or die "Cannot open $sendmail: $!"
print SENDMAIL "From: $email1\n";
print SENDMAIL "To: $recipient\n";
print SENDMAIL "BCC: $cc\n";
print SENDMAIL "Subject: $subject\n\n";
print SENDMAIL "Thanks, $name for your order!\n\n";
print SENDMAIL "You have ordered:\n";
print SENDMAIL "<ul>";
foreach $CATALOG (@CATALOG) { print SENDMAIL "<li>$CATALOG \n"; }
print SENDMAIL "</ul>";
print SENDMAIL "\n\n";
print SENDMAIL "In Christ,\n\n";
print SENDMAIL "-Harvest Group MA ";
close (SENDMAIL);
&thank_you;
#########################################################
# Redirect the Browser Page using unordered list "<ul></ul>" #
#########################################################
sub thank_you {
print "<html>";
print "<head><title>Order Confirmation</title></head>";
print "<body bgcolor=#800000>";
print "<font face=Tempus Sans ITC color=white><h2>Thanks, $name for your order!</h2></font>";
print "<font face=Tempus Sans ITC color=white><h3>On behalf of $company, $name has ordered:";
print "<ul>";
foreach $CATALOG (@CATALOG) { print "<li>$CATALOG \n"; }
print "</ul>";
print "These catalogs will be shipped within two business days.</h3>";
print "<b>An e-mail confirmation has been sent to</FONT><FONT COLOR=#DAA520> $recipient</FONT>
<font face=Tempus Sans ITC color=white> in zip code:</FONT> <FONT COLOR=#DAA520>$zip.</b></font><br>";
print "</body>";
print "</html>";
exit(0);
}
Thanks!
Tomsweb
The customer selects to receive any of several catalogs at current online Web site Order Form.
Based on the customer's inputted zip code, a specific sales rep. will get this personal and catlog order information via email message.
I cannot get "print SENDMAIL" to write all catalog selections from @CATALOG array.
Can anyone offer assistance?
#!/usr/bin/perl
######################################
# Harvest Group Marketing Associates #
# Catalog Order Script #
######################################
#
# Create the CGI Object
#
use CGI;
my $q = new CGI;
#
# Output the HTTP Header
#
print "Content-type:text/html\n\n";
######################################
# Set up the variables #
######################################
@CATALOG = $q->param('Catalog');
$name = $q->param('Name');
$company = $q->param('Title');
$email1 = $q->param('Email');
$cc = $q->param('cc_mail');
my $zip = $q->param('Zip');
my $recipient = zipmail($zip);
my $sendmailpath = "/usr/sbin/sendmail -t";
my $subject = "Catalog Order Request";
###################################
# Match User Zip Codes to get $recipient e-mail
###################################
sub zipmail($) {
if($zip == '17705') {$recipient="tom_fitzsimmons\@micro-link.net";}
elsif(($zip >='17701') && ($zip <= '17799')) {$recipient="cookies\@micro-link.net";}
else {$recipient="mikeshaf\@ptd.net";}
}
####################################################
# Send email to customer to confirm Catalog Order #
####################################################
open(SENDMAIL, "¦$sendmailpath" or die "Cannot open $sendmail: $!"
print SENDMAIL "From: $email1\n";
print SENDMAIL "To: $recipient\n";
print SENDMAIL "BCC: $cc\n";
print SENDMAIL "Subject: $subject\n\n";
print SENDMAIL "Thanks, $name for your order!\n\n";
print SENDMAIL "You have ordered:\n";
print SENDMAIL "<ul>";
foreach $CATALOG (@CATALOG) { print SENDMAIL "<li>$CATALOG \n"; }
print SENDMAIL "</ul>";
print SENDMAIL "\n\n";
print SENDMAIL "In Christ,\n\n";
print SENDMAIL "-Harvest Group MA ";
close (SENDMAIL);
&thank_you;
#########################################################
# Redirect the Browser Page using unordered list "<ul></ul>" #
#########################################################
sub thank_you {
print "<html>";
print "<head><title>Order Confirmation</title></head>";
print "<body bgcolor=#800000>";
print "<font face=Tempus Sans ITC color=white><h2>Thanks, $name for your order!</h2></font>";
print "<font face=Tempus Sans ITC color=white><h3>On behalf of $company, $name has ordered:";
print "<ul>";
foreach $CATALOG (@CATALOG) { print "<li>$CATALOG \n"; }
print "</ul>";
print "These catalogs will be shipped within two business days.</h3>";
print "<b>An e-mail confirmation has been sent to</FONT><FONT COLOR=#DAA520> $recipient</FONT>
<font face=Tempus Sans ITC color=white> in zip code:</FONT> <FONT COLOR=#DAA520>$zip.</b></font><br>";
print "</body>";
print "</html>";
exit(0);
}
Thanks!
Tomsweb