I need another set of eyes to look at this and see what I'm missing...
This CGI/Perl script has the following purposes:
1) To verify that the required form fields are completed
2) In the event that they are not, to recreate the form
3) In the event that they are, to do the following:
a) To redirect the viewer to a confirmation screen
b) To send the viewer an email, based on an if/then test, including the data from the form fields
c) To send a third party an email containing the data from the form fields
When I tested the program yesterday morning, the "pay by check" email was sent to the viewer, but the third party email was not sent. When I subsequently tested it, none of the email functions worked. I have verified with the host that the sendmail path is correct. Do you see anything in my code that I need to fix to make this work (I've taken out the section to verify the form fields and recreate the form, to save space)? Thank you in advance.
This CGI/Perl script has the following purposes:
1) To verify that the required form fields are completed
2) In the event that they are not, to recreate the form
3) In the event that they are, to do the following:
a) To redirect the viewer to a confirmation screen
b) To send the viewer an email, based on an if/then test, including the data from the form fields
c) To send a third party an email containing the data from the form fields
When I tested the program yesterday morning, the "pay by check" email was sent to the viewer, but the third party email was not sent. When I subsequently tested it, none of the email functions worked. I have verified with the host that the sendmail path is correct. Do you see anything in my code that I need to fix to make this work (I've taken out the section to verify the form fields and recreate the form, to save space)? Thank you in advance.
Code:
#!/usr/bin/perl
#Run subroutine to turn form data into an array named %in
require "cgi-lib.pl";
&ReadParse;
#Define variable identifying path to sendmail program
$mailprog = '/usr/lib/sendmail';
#Verify name, phone and email fields are not blank
#Recreate form and shut down program
#If all required info is present print confirmation message
#If pay by check
if ($in{'payment'} eq "check")
{
#Open sendmail program to send message to pay by check
open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";
#Print message headers (To, Reply-To, From, Subject)
print MAIL "To: $in{'email'}\n";
print MAIL "Reply-To: $in{'mmail'}\n";
print MAIL "From: $in{'mmail'}\n";
print MAIL "Subject: Thank you for your support\!\n\n";
#Print body of message
print MAIL <<"PrintTag";
Thank you for your RSVP to the Vineyard of Hope Wine Tasting and Silent Auction!
In order to keep our administrative costs low, we do not print individual tickets. Please accept this letter as confirmation of your reservation. Your name will be included on the guest list at the door. Please print a copy of this letter and mail with your check to:
Catholic Social Services
Attn: Sherry Luc
1123 South Church Street
Charlotte, NC 28203
If you need to cancel, we ask that you do so at least three business days prior to the event in order to receive a refund.
Should you have any questions regarding the event, or should you need to change your registration information as it appears below, please contact Joyce Bonaventura at 704-376-8870, or by email at joyceb\@vineyardofhope.com.
Your registration information is:
Name: $in{'name'}
Address: $in{'add1'}
$in{'add2'}
$in{'city_state_zip'}
Phone: $in{'daytime_phone'}
Email Address: $in{'email'}
Couples: $in{'couples'}
Individuals: $in{'individuals'}
Total Cost: \$ $in{'total'}
We look forward to seeing you and thank you for your support of Catholic Social Services!
PrintTag
#Close sendmail program, releasing message to be sent
close (MAIL);
}
#If pay by credit card
else
{
#Open sendmail program to send message
open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";
#Print message headers (To, Reply-To, From, Subject)
print MAIL "To: $in{'email'}\n";
print MAIL "Reply-To: $in{'mmail'}\n";
print MAIL "From: $in{'mmail'}\n";
print MAIL "Subject: Thank you for your support\!\n\n";
#Print body of message
print MAIL <<"PrintTag";
Thank you for your RSVP to the Vineyard of Hope Wine Tasting and Silent Auction!
In order to keep our administrative costs low, we do not print individual tickets. Please accept this letter as confirmation of your reservation. Your name will be included on the guest list at the door. We will contact you within 48 hours to obtain the necessary credit card information to confirm your reservation.
If you need to cancel, we ask that you do so at least three business days prior to the event in order to receive a refund.
Should you have any questions regarding the event, or should you need to change your registration information as it appears below, please contact Joyce Bonaventura at 704-376-8870, or by email at joyceb\@vineyardofhope.com.
Your registration information is:
Name: $in{'name'}
Address: $in{'add1'}
$in{'add2'}
$in{'city_state_zip'}
Phone: $in{'daytime_phone'}
Email Address: $in{'email'}
Couples: $in{'couples'}
Individuals: $in{'individuals'}
Total Cost: \$ $in{'total'}
We look forward to seeing you and thank you for your support of Catholic Social Services!
PrintTag
#Close sendmail program, releasing message to be sent
close (MAIL);
}
#Open sendmail program to send message to Vineyard of Hope
open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";
#Print message headers (To, Reply-To, From, Subject)
print MAIL "To: $in{'mmail'}\n";
print MAIL "Reply-To: $in{'email'}\n";
print MAIL "From: $in{'email'}\n";
print MAIL "Subject: VOH Reservation\n\n";
#Print body of message
print MAIL <<"PrintTag";
A reservation request has been submitted with the following information:
Name: $in{'name'}
Address: $in{'add1'}
$in{'add2'}
$in{'city_state_zip'}
Phone: $in{'daytime_phone'}
Email Address: $in{'email'}
Couples: $in{'couples'}
Individuals: $in{'individuals'}
Total Cost: \$ $in{'total'}
Payment Type: $in{'payment'}
PrintTag
#Close sendmail program, releasing message to be sent
close (MAIL);
#End of script