PHP Mail send problem

Posted on 2011-10-23
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 = "";
$donotreply_email = "";
$me = "";
$me = "";

$subject = " 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
    LVL 7

    Accepted Solution

    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

    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 107

    Assisted Solution

    by:Ray Paseur
    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
    Have you checked your Junk/Spam folder in your email to see if you have got the message there?

    Author Closing Comment

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

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now