Jump to content

SOS! PHP Email processing script returns "500 - Internal Server Error"


ashbullmanuk

Recommended Posts

[ Contact Us ]

Thank your email, it has been successfully sent. We shall soon receive it and will respond as soon as possible.

If your query requires an urgent reply, or you already have a project underway with us, you can email directly to the relevent person:

Concept Arts : conceptarts@kyu-images.com

Web Concepts : webconcepts@kyu-images.com

Photography : photography@kyu-images.com

Enquiries : enquiries@kyu-images.com

 

Or telephone : 01502 281284 between 09:00 - 18:00 Monday to Friday, and 10:00 - 15:00 Saturday.

Please choose where to go next:

[ Home ]

[ About Us ]

[ Web Design ]

[ Logo Design ]

[ Brand Imaging ]

[ Photography ]

Link to comment
Share on other sites

The script itself seems to be fine... at least, I'm not seeing any significant coding issues. As a start, perhaps try creating a new file with these contents (replace the email address), and uploading it to your server:

 

mailtest.php:


 

Open that up in your browser, and see if you still get the error. I'm just trying to check that the mail() function works correctly before debugging the script further.

Link to comment
Share on other sites

Ok I found a script on the net that should send data from any form without knowing much about it, kind of a generic handler. I copied and uploaded, set the form action to follow it, and tested it.

 

It returned a failed to send message. (the message is coded in the PHP for failure to send the message).

 

So to it looks more likely an external problem????? The script I tried is:

 

<?php

if ($_SERVER['REQUEST_METHOD']=="POST"){

// In testing, if you get an Bad referer error

// comment out or remove the next three lines

if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||

!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))

die("Bad referer");

$msg="Values submitted by the user:\n";

foreach($_POST as $key => $val){

if (is_array($val)){

$msg.="Item: $key\n";

foreach($val as $v){

$v = stripslashes($v);

$msg.=" $v\n";

}

} else {

$val = stripslashes($val);

$msg.="$key: $val\n";

}

}

$recipient="enquiries@kyu-images.com";

$subject="General Web Enquiry";

error_reporting(0);

if (mail($recipient, $subject, $msg)){

echo "

Thank you

Message successfully sent:

\n";

echo nl2br($input);

} else

echo "An error occurred and the message could not be sent.";

} else

echo "Bad request method";

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...