PDA

View Full Version : Mail Script Error


NeilKelty
07-13-2005, 11:07 PM
When the form on the page contact.php requests processing from processform.php and error is generated stating the following:


Warning: mail(): SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in C:\Domains\terryhaffner.com\wwwroot\processform.php on line 88

The links that may be needed are:
http://www.terryhaffner.com/contact.php
http://www.terryhaffner.com/processform.php?code=2

The PHP Code in processform.php is as follows:

<?php
$code = 0;
$code = $_GET['code'];

if($code == 1){
$name = $_POST['fullname'];
$recipient = 'buy@terryhaffner.com';
$subject = "Buy A Painting";
$from = stripslashes($_POST['email']);
$msg = "$fullname has sent a comment to you!\n\n".stripslashes($_POST['message']);
mail($recipient, $subject ,$msg, "From: $email\n");

echo '<p>We appreciate your comments</p>';
}
else if($code == 2){
$toValue = 0;
$toValue = $_POST['recipient'];
$name = $_POST['fullname'];
$from = stripslashes($_POST['email']);
$msg = "$fullname has sent a comment to you!\n\n".stripslashes($_POST['message']);
$subject = "Website";
$subject = $_POST['subject'];

if($toValue == 1){
$to = "terry@terryhaffner.com";
}
else if($toValue == 2){
$to = "support@terryhaffner.com";
}
else if($toValue == 4){
$to = "buy@terryhaffner.com";
}
else if($toValue == 5){
$to = "appear@terryhaffner.com";
}
else{
$to = "wbmstr@terryhaffner.com";
}

mail($recipient, $subject ,$msg, "From: $email\n");

echo '<p>We appreciate your comments</p>';

}
else{
echo 'Please use a valid form';
}
?>

missing-score
07-14-2005, 01:26 AM
Not 100% sure here, but it looks more like you don't have SMTP configured properly... Is this a local server you are running?

NeilKelty
07-14-2005, 04:19 PM
Nope, the funny thing is the code == 1 section will work if called, its the code == 2 section that wont work.

NeilKelty
07-14-2005, 06:35 PM
Any suggestions?

NeilKelty
07-18-2005, 02:46 AM
This problem is still an issue...any suggestions?

Jalenack
07-18-2005, 03:41 AM
Don't mean to be cheeky but:

Reading the error message more closely might have have led you to the problem. The recipient is not defined. So check the $recipient in the mail() function. It has yet to be defined, because in the $code = 2 conditional, you're using $to instead of $recipient

mail($to, $subject ,$msg, "From: $email\n");