PHP email error

Ok, I did this php email tutorial exactly like this dude said.
The email thing looks good and says “Your message has been sent” but it doesnt work.
Here is the tutorial

http://www.sephiroth.it/tutorials/flashPHP/email/page001.php

and here is my email form.
http://www.rawguru.com/feedback.html

my php file
http://www.rawguru.com/sendmail.php

which shows an error

Please help. I gotta have one of these email forms.
Thanks in advance!
Alex

Can you post the PHP code and the AS you used ?

<?
if(!empty($_POST[‘sender_mail’])
|| !empty($_POST[‘sender_message’])
|| !empty($_POST[‘sender_subject’])
|| !empty($_POST[‘sender_name’]))
{
$to = "[email protected]"; // replace with your mail address
$s_name = $_POST[‘sender_name’];
$s_mail = $_POST[‘sender_mail’];
$subject = stripslashes($_POST[‘sender_subject’]);
$body = stripslashes($_POST[‘sender_message’]);
$body .= "


";
$body .= "Mail sent by: $s_name <$s_mail>
";
$header = "From: $s_name <$s_mail>
";
$header .= "Reply-To: $s_name <$s_mail>
";
$header .= “X-Mailer: PHP/” . phpversion() . "
";
$header .= “X-Priority: 1”;
if(@mail($to, $subject, $body, $header))
{
echo “output=sent”;
} else {
echo “output=error”;
}
} else {
echo “output=error”;
}
?>

Now that I think about it, your PHP file may show an error because when you enter the PHP file, you’re not defining any vars, which makes PHP unable to send a mail. I can’t see any errors in the PHP file, but try replacing it with this:

<?
//flash should check for empty fields, not PHP
$to = "[email protected]"; // replace with your mail address
$s_name = $_POST['sender_name'];
$s_mail = $_POST['sender_mail'];
$subject = stripslashes($_POST['sender_subject']);
$body = stripslashes($_POST['sender_message']);
$body .= "

---------------------------
";
$body .= "Mail sent by: ".$s_name." <".$s_mail.">
";
$header = "From: ".$s_name." <".$s_mail.">
";
$header .= "Reply-To: ".$s_name." <".$s_mail.">
";
$header .= "X-Mailer: PHP ".phpversion()."
";
$header .= "X-Priority: 1";
if(@mail($to, $subject, $body, $header))
{
echo "output=sent";
} else {
echo "output=error";
}
?>

What AS did you use ?

Nope, didnt work either.
Man, this sucks. Maybe i need to do this.

Since all the mail arguments (except for the $to variable) are passed by another page (Flash in this case) we need to add the if statement at the beginning in order to check if they are all defined.
So, if one of those HTTP_POST_VARS variales is empty, don’t run the mail code and return an error message: output=error

Otherwise, if all those variables exist and they’re not empty, we define our mail paramenters paying atention to these lines:

$subject = stripslashes($_POST[‘sender_subject’]);
$body = stripslashes($_POST[‘sender_message’]);

We do that because if user input this text: “I’m the one” (example) and we dont’ use the stripslashes function, we will receive an email with this text: “I’m the one”. In fact stripslashes returns a string with backslashes stripped off.
Then we add this headers to our email:

$header = "From: $s_name <$s_mail>
";
$header .= "Reply-To: $s_name <$s_mail>
";
$header .= “X-Mailer: PHP/” . phpversion() . "
";
$header .= “X-Priority: 1”;

From defines the mail sender, Reply-To (not necessary here) is necessary when the reply recipient is different from the sender email. (When you press the ‘reply’ button on your mail reader, the email is sent, if defined, to the Reply-To address).
Header finishes with the X-Mail (The php page itself and the php running version) and the X-Priority of the mail (1 is urgent, 3 is normal)

Well, then I’d suggest you find another tutorial.