1

i have an email form and it wont work. i have made sure the email is correct and is working, but i keep getting the 'or die' error. Please help. here is the code:

<?php
$to = "****@***********.com";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$send = mail($to, $name, $subject, $message, $headers)
or die('Could Not Send');
echo'Sent!';

?>
4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by morteza_ipo
0

The format for the mail statement is:

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

You have one too many parameters for your mail statement ($name)

If you don't have a copy of the php manual, you should download one.

Chris

Edited by chrishea: n/a

0

Please test it:

<?php
$to = "****@***********.com";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $name . $_REQUEST['message'];
$headers = "From: $email";
if(@mail($to, $subject, $message, $headers))
{
echo "Your mail sent";
}
else
{
echo 'Error on sending';
}
?>

'@' return true or false!

mail function gets 4 options!

Edited by morteza_ipo: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.