SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    177
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Internal Server Error on script

    Hi,

    I am trying to implement a mail script to my site at http://tinyurl.com/2ppa2q (tinyurl for search index purposes)

    It calls the script in the address bar but then throws up the internal server error.

    I have implemented several similar basic perl contact form scripts and tried a few things that fixed the others like:

    Setting the file to 755
    Making sure the file name doesn't contain mail references etc.
    Uploaded in ASCII mode

    Thanks

    Below is the .pl file code:

    Code:
    #!/usr/bin/perl
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard);
    print "Content-type: text/html \n\n"; 
    
    # get posted data into local variables
    $input = new CGI;
    $EmailFrom = $input->param('EmailFrom'); 
    $Subject = "General Form Enquiry";
    $Name = $input->param('Name'); 
    $Email = $input->param('Email'); 
    $Enquiry = $input->param('Enquiry'); 
    
    # validation
    $validationOK=true;
    if ($EmailFrom eq '') {$validationOK=false;}
    if ($validationOK eq false) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
      exit;
    }
    
    # prepare email body text
    $Body .= "Name: ";
    $Body .= "$Name";
    $Body .= "\n";
    $Body .= "Email: ";
    $Body .= "$Email";
    $Body .= "\n";
    $Body .= "Enquiry: ";
    $Body .= "$Enquiry";
    $Body .= "\n";gf
    
    # send email 
    $mailprog = '/usr/sbin/sendmail -t';
    open(MAIL,"|$mailprog");
    print MAIL "To: $EmailTo\n";
    print MAIL "From: $EmailFrom\n";
    print MAIL "Subject: $Subject\n\n";
    print MAIL $Body;
    close(MAIL);
    
    # redirect to success page 
    print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
    Last edited by jdog1; Jul 20, 2007 at 00:50.

  2. #2
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks like it shoudl work if you did all the stuff you said you did. Check the server error log if possible. Bare words should be avoided though:

    $validationOK=true;
    if ($EmailFrom eq '') {$validationOK=false;}
    if ($validationOK eq false) {

    you should quote those words.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •