The following causes a 500 internal error when I add it to the standard cgi
email handler. Where is the issue that is causing the internal error. I love
php where it tells you the line number/description of your error!!! While I
would normally use php, the website uses this cgi script, and as such, its
meant to be easier to just tweak the existing script...

My extra that causes the problem:

    open(MAIL,"|$mailprog");

    print MAIL "To: [EMAIL PROTECTED]";
    print MAIL "From: $Config{'email'} ($Config{'realname'})\n";

    print MAIL "Subject: $Config{'subject'}\n\n";

    print MAIL "$Config{'subject'} - $Config{'realname'} ($Config{'email'})
on $date\n";

    close (MAIL);


the code that works - follows the above added code:

    open(MAIL,"|$mailprog");

    print MAIL "To: $Config{'recipient'}\n";
    print MAIL "From: $Config{'email'} ($Config{'realname'})\n";

    # Check for Message Subject
    if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
    else                    { print MAIL "Subject: WWW Form Submission\n\n"
}

    print MAIL "Below is the result of your feedback form.  It was submitted
by\n";
    print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
    print MAIL "-" x 75 . "\n";

    if (@Print_Config) {
        foreach $print_config (@Print_Config) {
            if ($Config{$print_config}) {
                print MAIL "$print_config: $Config{$print_config}\n";
            }
        }
    }

    # If a sort order is specified, sort the form fields based on that.
#
    if ($Config{'sort'} =~ /^order:.*,.*/) {

        # Remove extraneous line breaks and spaces, remove the order:
#
        # directive and split the sort fields into an array.
#
        local $sort_order = $Config{'sort'};
        $sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
        $sort_order =~ s/(\s+)?\n+(\s+)?//g;
        $sort_order =~ s/order://;
        @sorted_fields = split(/,/, $sort_order);

        # For each sorted field, if it has a value or the print blank
#
        # fields option is turned on print the form field and value.
#
        foreach $sorted_field (@sorted_fields) {
            if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '')
{
                print MAIL "$sorted_field: $Form{$sorted_field}\n";
            }
        }
    }

    # Otherwise, print fields in order they were sent or alphabetically.
#
    else {

        # Sort alphabetically if specified:
#
        if ($Config{'sort'} eq 'alphabetic') {
            @Field_Order = sort @Field_Order;
        }

        # For each form field, if it has a value or the print blank
#
        # fields option is turned on print the form field and value.
#
        foreach $field (@Field_Order) {
            if ($Config{'print_blank_fields'} || $Form{$field} ne '') {
                print MAIL "$field: $Form{$field}\n";
            }
        }
    }

    print MAIL "-" x 75 . "\n";

    # Send any specified Environment Variables to recipient.
#
    foreach $env_report (@Env_Report) {
        if ($ENV{$env_report}) {
            print MAIL "$env_report: $ENV{$env_report}\n";
        }
    }

    close (MAIL);




Thanks
Michael Brandon


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to