CGI Sendmail Form Issue, error with email.cgi using email.conf to send form data |
CGI Sendmail Form Issue, error with email.cgi using email.conf to send form data |
tommy5725 |
Feb 15 2007, 03:43 AM
Post
#1
|
Group: Members Posts: 4 Joined: 15-February 07 Member No.: 1,909 |
to duplicate the error visit "www.newmanlandscaping.com" and select contact, from the left navigation bar. Submit the form and you will recieve the error "The requested destination address is not one of the permitted email recipients. Please read the documentation before installing email.cgi." below is the code.
"contact.htm" <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <title>Contact</title> <head> <META name="description" content="The Best in Landscaping, Watergardens, and Environmental Design."> <META name="keywords" content="Landscaping, Watergardens; Lawnscaping, Lawn Care, Lawn Maintenance, Shrub Work"> </head> <BODY BGCOLOR=#225922 TEXT=#F9F9F9 LINK=#225922 VLINK=#225922> <center><strong> Contact Us Directly: Call or Fax: (315) 853-3798 - Or By Cell 24/7 at: (315) 269-6440</strong><br> <small> *** All fields below are optional and are not required. However, rest assured that your personal information is a top priority to everyone at Newman Landscaping. Your information will not be sold or shared with anyone, without your consent. *** </small> <form method="POST" action="../cgi-bin/email.cgi"> <!-- This hidden form field contains the email address of the recipient, but we don't just blindly trust it. email.cgi checks email.conf. --> <input type="hidden" name="recipient" value="contact@newmanlandscaping.com"> <center> <FIELDSET> <LEGEND> <strong>Contact Information : </strong></LEGEND> <strong>Name: <INPUT name="name" type="text" tabindex="1"></strong> <strong>Phone: <INPUT name="phone" type="text" tabindex="2"></strong> <strong>Email: <INPUT name="email" type="text" tabindex="3"></strong><br><br> <strong>Preferred Contact Method:</strong> <SELECT name="preferred_contact"> <OPTION> Phone </OPTION> <OPTION> Email</OPTION> <OPTION> Other</OPTION> </SELECT><br><br> </FIELDSET> <FIELDSET> <LEGEND> <strong> Related Services : </strong></LEGEND> <INPUT name="service_inquiry" type="checkbox" value="Rolling/Fertilizing" tabindex="20"> Rolling/Fertilizing <INPUT name="service_inquiry" type="checkbox" value="Yard Maintenance" tabindex="21"> Yard Maintenance <INPUT name="service_inquiry" type="checkbox" value="Summer Mowing/Trimming" tabindex="22"> Mowing/Trimming <INPUT name="service_inquiry" type="checkbox" value="Snow Removal" tabindex="23"> Snow Removal <INPUT name="service_inquiry" type="checkbox" value="Landscaping Projects or Design" tabindex="23"> Landscaping Projects or Design<br><br> <strong>Inquiry Type : </strong> <SELECT name="inquiry_type"> <OPTION> Season Package </OPTION> <OPTION> Contracting </OPTION> <OPTION selected> General Question </OPTION> <OPTION> Bulk Rates </OPTION> <OPTION>Other</OPTION> </SELECT><br><br> </FIELDSET> <FIELDSET> <LEGEND> <strong>Free Form Message : </strong></LEGEND> Are you including address information and/or requesting a quote? <INPUT name="address_quote" type="radio" value="Yes" tabindex="35">Yes <INPUT name="address_quote" type="radio" value="No" tabindex="35">No<br><br> <TEXTAREA name="message_content" rows="6" cols="90" tabindex="40"> </TEXTAREA><br><br><input type="submit" value=Submit><BR><br> </FIELDSET></BODY> </center></FORM> </HTML> email.cgi: #!/usr/bin/perl # A simple Perl-based CGI email handler. # # Copyright 2004 Boutell.Com, Inc. Compatible with our earlier C program. # # Released under the same license terms as Perl 5 itself. # # We ask, but do not require, that you link to # http://www.boutell.com/email/ when using this script or a # variation of it. use CGI; my $sendmail = "/usr/sbin/sendmail"; # A text file containing a list of valid email recipients and the web pages to # which the user should be redirected after email is sent to each, on # alternating lines. This allows one copy of the script to serve multiple # purposes without the risk that the script will be abused to send spam. # YOU MUST CREATE SUCH A TEXT FILE AND CHANGE THE NEXT LINE TO ITS # LOCATION ON THE SERVER. my $emailConfPath = "/home/newmanla/public_html/email.conf"; # Parse any submitted form fields and return an object we can use # to retrieve them my $query = new CGI; my $name = &veryclean($query->param('name')); my $email = &veryclean($query->param('email')); my $recipient = &veryclean($query->param('recipient')); my $subject = &veryclean($query->param('subject')); #newlines allowed my $content = &clean($query->param('content')); #Note: subject is not mandatory, but you can easily change that if (!open(IN, "$emailConfPath")) { &error("Configuration Error", "The file $emailConfPath does not exist or cannot be " . "opened. Please read the documentation before installing " . "email.cgi."); } my $returnpage; my $ok = 0; while (1) { my $recipientc = <IN>; $recipientc =~ s/\s+$//; if ($recipientc eq "") { last; } my $returnpagec = <IN>; $returnpagec =~ s/\s+$//; if ($returnpagec eq "") { last; } if ($recipientc eq $recipient) { $ok = 1; $returnpage = $returnpagec; last; } } close(IN); if (!$ok) { &error("Email Rejected", "The requested destination address is not one of " . "the permitted email recipients. Please read the " . "documentation before installing email.cgi."); } # Open a pipe to the sendmail program open(OUT, "|$sendmail -t"); # Use the highly convenient <<EOM notation to include the message # in this script more or less as it will actually appear print OUT <<EOM To: $recipient Subject: $subject Reply-To: $email Supposedly-From: $name [This message was sent through a www-email gateway.] $content EOM ; close(OUT); # Now redirect to the appropriate "landing" page for this recipient. print $query->redirect($returnpage); exit 0; sub clean { # Clean up any leading and trailing whitespace # using regular expressions. my $s = shift @_; $s =~ s/^\s+//; $s =~ s/\s+$//; return $s; } sub veryclean { # Also forbid newlines by folding all internal whitespace to # single spaces. This prevents faking extra headers to cc # extra people. my $s = shift @_; $s = &clean($s); $s =~ s/\s+$/ /g; return $s; } sub error { # Output a valid HTML page as an error message my($title, $content) = @_; print $query->header; print <<EOM <html> <head> <title>$title</title> </head> <body> <h1 align="center">$title</h1> <p> $content </p> EOM ; exit 0; } email.conf contact@newmanlandscaping.com /thank_you.htm Any help is greatly appreciated, thank you in advance, Töm |
pandy |
Feb 15 2007, 05:50 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,732 Joined: 9-August 06 Member No.: 6 |
The requested destination address is not one of the permitted email recipients. So is the a email address one of the permitted ones? QUOTE Please read the documentation before installing email.cgi. Did you read it? QUOTE <!-- This hidden form field contains the email address of the recipient, but we don't just blindly trust it. email.cgi checks email.conf. --> <input type="hidden" name="recipient" value="contact@newmanlandscaping.com"> Seems that email addess isn't in the email.conf . http://newmanlandscaping.com/email.conf |
tommy5725 |
Feb 15 2007, 06:50 AM
Post
#3
|
Group: Members Posts: 4 Joined: 15-February 07 Member No.: 1,909 |
I rebooted and am now am receiving the email but with no data. Everything processes and the "return page" or "landing page" is displayed but, I get nothing in my email box.
Thank you all so very much!!!! Töm |
tommy5725 |
Feb 15 2007, 06:53 AM
Post
#4
|
Group: Members Posts: 4 Joined: 15-February 07 Member No.: 1,909 |
I mean I get the email but it's blank.
thanks again, Töm |
tommy5725 |
Feb 16 2007, 05:19 AM
Post
#5
|
Group: Members Posts: 4 Joined: 15-February 07 Member No.: 1,909 |
Pandy;
QUOTE(tommy5725 @ Feb 15 2007, 09:43 AM) The requested destination address is not one of the permitted email recipients. So is the a email address one of the permitted ones? QUOTE Please read the documentation before installing email.cgi. Did you read it? QUOTE <!-- This hidden form field contains the email address of the recipient, but we don't just blindly trust it. email.cgi checks email.conf. --> <input type="hidden" name="recipient" value="contact@newmanlandscaping.com"> Seems that email addess isn't in the email.conf . http://newmanlandscaping.com/email.conf Well yeah, -the full scripts are posted and you can see the text, each one starts with the "RED" title. But I can't figure out why I'm getting a blank email when the form is submitted. Thanks for any help. Töm This post has been edited by tommy5725: Feb 16 2007, 05:23 AM |
Lo-Fi Version | Time is now: 27th April 2024 - 02:02 AM |