Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


PHP Mail send problem

Posted on 2011-10-23
Medium Priority
Last Modified: 2012-05-12
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

$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




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

Best regards

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

     "Receipt from $me",
     "From: $donotreply_email\nReply-To: $donotreply_email");

<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.


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

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

Open in new window

Question by:3XLcom

Accepted Solution

pegasys earned 500 total points
ID: 37013715
Can you tell us what error comes up when you execute that script?

Also I would change:

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


"From: $donotreply_email");
LVL 19

Assisted Solution

xterm earned 500 total points
ID: 37014312
Your syntax is perfect for the mail command.  Please add the following lines at the top of your page and then re-execute it:

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.
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 500 total points
ID: 37016736
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.
LVL 12

Assisted Solution

by:Mohamed Abowarda
Mohamed Abowarda earned 500 total points
ID: 37017811
Have you checked your Junk/Spam folder in your email to see if you have got the message there?

Author Closing Comment

ID: 37037768
Thanks every body problem was safe mode. we resolve the issue kin regards

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question