I don't know what to tell you. If you want to have better error handeling, I would suggest moving to the PEAR mail function. It's rather easy to implement.
Here's an implementation that I use:
require_once('Mail.php');
require_once('PEAR.php');
$breaks = array("\r", "\n", "\r\n", "<br>", "<br />");
$Email = $_REQUEST['email'];
$Comments = $_REQUEST['comments'];
$Name = $_REQUEST['fullname'];
$Recip = $_REQUEST['recip'];
$Subject = '[RSC] '.eregi_replace($breaks, " ", $_REQUEST['subject']);
$Today = date("l F d, Y");
$Time = date("g:i A");
$fromcc = '"'.$Name.'" <'.$Email.'>';
$params['host'] = "mail.domain.com";
$params['port'] = "25";
$params['auth'] = TRUE;
$params['username'] = "username";
$params['password'] = "password";
$recips = $Recip.', ';
$recips .= $Email;
$headers['From'] = $fromcc;
$headers['To'] = $Recip;
$headers['Cc'] = $fromcc;
$headers['Subject'] = $Subject;
$headers['Date'] = date("r");
$comments = wordwrap($Comments, 70);
$MessageTop ="This is an email from the Ridge Swim Club Website.\n\n";
$MessageTop .="This message was sent by:\nName: $Name\nEmail: $Email\n\n";
$MessageBody = ">========== Message ==========<\n\n";
$MessageBody .= $comments."\n\n";
$MessageBody .= ">========== End Message ==========<\n";
$MessageBottom = "Message sent on: ".$Today." at ".$Time;
$WholeMessage = $MessageTop.$MessageBody.$MessageBottom;
$Message = eregi_replace($breaks, "\n..", $WholeMessage);
$message = stripslashes($Message);
$mail = &Mail::factory('smtp', $params);
if(PEAR::isError($mail)){
$show = "<b><font style='font-size: 14px;'>Can't Connect to the Mail server!</font></b><br />";
$show .= $mail->getMessage();
$_REQUEST['pageid'] = '23';
}
else{
if(PEAR::isError($error = $mail->send($recips, $headers, $message))){
$show = "<b><font style='font-size: 14px;'>Can't Send the email through the account!</font></b><br />";
$show .= $error->getMessage();
$_REQUEST['pageid'] = '23';
}
else{
$_REQUEST['pageid'] = '22';
}
}
It took me a while to get it working (cuz I couldn't figure out what was wrong: my connection to my site) but now it works like a charm. If you have PEAR installed, I would suggest using it. If you don't, I would suggest seeing about enabling it.
Your code, would then look like:
<?php
require_once('Mail.php');
require_once('PEAR.php');
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$feedback =$_REQUEST['feedback'];
$params['host'] = "mail.domain.com";
$params['port'] = "25";
$params['username'] = "username";
$params['password'] = "password";
$recip = "masood131@yahoo.com";
$headers['From'] = "Sitename <webserver@example.com>";
$headers['To'] = "Your Name";
$headers['Cc'] = $email;
$headers['Subject'] = "Feedback from the website";
$headers['Date'] = date("r");
$comments = wordwrap($feedback, 70);
$comments = stripslashes($comments);
$mail = &Mail::factory('smtp', $params);
if(PEAR::isError($mail)){
$show = "Error!!<br />".$mail->getMessage();
}
else{
if(PEAR::isError($error = $mail->send($recip, $headers, $comments))){
$show = "Error!!<br />".$error->getMessage();
}
else{
echo"<html>
<head>
<title>Bob's Auto Parts- Feedback Submitted</title>
</head>
<body>
<h1>Feedback Submitted</h1>
<p>Your feedback has been sent.</p>
</body>
</html>";
}
}
Don't know if PEAR is installed? Write a quick php file:
<?php
phpinfo();
?>
Place that anywhere, and go to it. After you're done using it, delete it. It contains sensitive information for your eyes only, and is a huge security risk.
Hope that helps you.
~Brett