PHP Mail send problem

The code given below is a ready to use script but can't send mail where should be the error i am sorry i do not understand php so much
<?php

$your_name = $_REQUEST['nametxt'];
$email = $_REQUEST['emailtxt'];
$message = $_REQUEST['messagetxt'];


$recipient_email = "xxxx@gmail.com";
$donotreply_email = "xxxx@gmail.com";
$me = "xxxx.com";
$me = "xxxx.com";

$subject = "aymedia.com message from " . $email;
//$headers = "From: " . $your_name . " <" . $email . ">\n";
//$headers .= 'Content-type: text/html; charset=iso-8859-1';

$content = "<html><head><title>Contact letter</title></head><body><br>";
$content .= "Name: <b>" . $your_name . "</b><br>";
$content .= "Email: <b>" . $email . "</b><br><hr><br>";
$content .= "Message: <b>" . $message . "</b><br>";
$content .= "<br></body></html>";




$forwardingthemessage = "$me

Has received the below message:

--------------------------------------------------
Name: $your_name
Email: $email

.........Message.........

$message

--------------------------------------------------


end of message";






$replymessage = "Hi $your_name

Thank you for your email.

We will follow up shortly.

Please DO NOT reply to this email.

Below is a copy of the message you submitted:
--------------------------------------------------
Name: $your_name
Email: $email
$message
--------------------------------------------------

Best regards
YOURWEBSITE.com";






mail("$recipient_email",
     "$subject",
     "$forwardingthemessage",
     "From: $email\nReply-To: $email");


mail("$email",
     "Receipt from $me",
     "$replymessage",
     "From: $donotreply_email\nReply-To: $donotreply_email");






?>
<html>
<body bgcolor="#000000">
<div align="center" style="margin-top:60px;color:#FFFFFF;font-size:11px;font-family:Tahoma;font-weight:bold">

Your message was sent. Thank you.

<BR><BR><BR>

<a href="javascript:history.back()"> <font color="FFFFFF"><---- Go Back</font> </a>

</div>
</body>
</html>
<!-- uncomment to resize the page -->	
<!-- <script>resizeTo(500, 500)</script> -->

Open in new window

3XLcomAsked:
Who is Participating?
 
pegasysCommented:
Can you tell us what error comes up when you execute that script?


Also I would change:

"From: $donotreply_email\nReply-To: $donotreply_email");

To:

"From: $donotreply_email");
0
 
xtermCommented:
Your syntax is perfect for the mail command.  Please add the following lines at the top of your page and then re-execute it:

ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting(E_ALL | E_STRICT);

This will hopefully give you an actual error message.  If you have root access to the server, you can also do "tail -f /var/log/maillog" when you send the message to see if it's actually attempting the send.  Also (as root) you can run the "mailq" command to see if any of your mails are queued due to some kind of global issue with sending on that machine.
0
 
Ray PaseurCommented:
Most PHP commands will give you a return value.  PHP mail() returns TRUE or FALSE.  You can test for this in your script and issue a diagnostic message.  But it is likely that the diagnostic message will not be visible unless you use "view source" because the HTML renders a black screen.  See line 89.
0
 
Mohamed AbowardaSoftware EngineerCommented:
Have you checked your Junk/Spam folder in your email to see if you have got the message there?
0
 
3XLcomAuthor Commented:
Thanks every body problem was safe mode. we resolve the issue kin regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.