Help please! Urgent! PHP form NOT going to inbox

For some reason I have this PHP form that I had put together which I thought was going to inbox which still is not. The form processes but every e-mail goes to the inbox. The only time it goes to the inbox is only if I’m launching it and testing the form through my PC. If somebody could help me fix this problem because this has been driving me stupid crazy. I had paid a local web company to put together the form and it seems it works but not sending to write location. This form is for my best friend / client website so that is why I sort of need it fixed ASAP. She’s starting to get pretty impatient so. I also have the HTML form code just below.

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

session_start();

if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {

    if($_POST['subject']=='1')

    {

        $to="kevra83@gmail.com";

       

    }

    $to="kevra83@gmail.com";

   

$subject = 'Form Submission';

    $message = "Visitor  Message

                First Name: " . $_POST['firstname'] ."\\r\
". "

                Last Name: " . $_POST['lastname'] ."\\r\
". "

                Phone Number: " . $_POST['phone'] ."\\r\
". "

                Email Address: " . $_POST['email'] ."\\r\
". "

                Comments.: " . $_POST['comment'] ."\\r\
". "

           

                   

                Sent to you by contact form.";

   

    $headers = 'From: kevra83@gmail.com' . "\\r\
" .

    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

include("contact.html");

}

else {

echo "Invalid Captcha String, please resubmit form and type in the image.";

}

?>


<div id="left">

      <div id="contact_form">

        <h1>Contact </h1>

        <p>Please fill out the information below.</p>

        <form method="post" action="formm.php" name="Customer Service Form">

  <input type="hidden" name="subject" value="Customer Service Inquiry">

  <input type="hidden" name="redirect" value="../thankyou.php">

<table width="550" border="0" align="center" cellpadding="0" cellspacing="6" class="style10">

  <tr>

    <td colspan="2"><b>*Denotes required fields:</b> </td>

  </tr>

  <tr>

    <td class="colorRed" colspan="2"></td>

  </tr>

  <tr>

    <td  colspan="2"> </td>

  </tr>

  <tr>

    <td width="319" ><div align="right"><b>*</b> First Name: </div></td>

    <td width="433" ><input type="text"  maxlength="40" size="18" value="" name="firstname" id="firstname" /></td>

  </tr>

 

  <tr>

    <td ><div align="right"><b>* </b>Last Name: </div></td>

    <td ><input type="text"  maxlength="40" size="18" value="" name="lastname" id="lastname" /></td>

  </tr>

 

  <tr>

    <td ><div align="right"><b>* </b>Phone Number: </div></td>

    <td ><input type="text"  maxlength="10" size="10" value="" name="phone" id="phone" /></td>

  </tr>

 

  <tr>

    <td ><div align="right"><b>* </b>Email Address: </div></td>

    <td >

      <input type="text"  maxlength="100" size="18" value="" name="email" id="email" />    </td>

  </tr>

  <tr>

    <td  colspan="2"> </td>

  </tr>

  <tr>

    <td><div align="right">Comments</div></td>

    <td><textarea cols="50" rows="8" wrap="virtual" maxlength="1000" name="comment" id="comment"></textarea></td>

  </tr>

  <tr>

    <td  colspan="2"> </td>

  </tr>

  <tr class="bodywhite_text">

    <td valign="top" class="bodytext3"><label class="formFieldQuestion">

      <div align="right">Type the image*&nbsp;<a class="info" href="#"><img src="tip_small.png" alt="For security purposes, please type the letters in the image." border="0" /></a><br />

        <img src="CaptchaSecurityImages.php" /> </div>

      </label></td>

    <td valign="top"><input id="captchaForm" name="security_code" class="mainForm" type="text"/></td>

  </tr>

  <tr>

    <td ></td>

    <td ><input name="Submit" type="submit" onclick="MM_validateForm('email','','RisEmail');return document.MM_returnValue" value="Submit" /></td>

  </tr>

</table>

</form></div>

      <div id="message_sent" style="display:none;">

        <h1>Your message has been sent</h1>

        <p>We'll contact you in a shortest possible time.</p>

        <p>You can now <a href="#" class="read-more">go back</a> to home page.</p>

      </div>

    </div>


There are a couple of reasons why php forms dont work. Overall I just glanced through the code and a couple of things you need to check are :

  1. The form submit says formm.php

<form method=“post” action=“formm.php” name=“Customer Service Form”>

So see if the php code is really under formm.php or is it form.php

Second thing I note is that Header from code is a gmail email id. Now some servers restrict from header to the domain it is from which is rare, but I have seen some servers do not like any other domain. So in the from header try to put your domain email id like email @ thisisthedomainname .com and try and it should work

Finally if the above two dont work, try removing the captcha code from the form and then trying. This option is really not needed and really if the captcha is wrong it should show a message, but maybe sometimes if captcha doesnot validate even then it might be creating issues.

Try and let us know how you fixed it

The file name is formm.php with two mm’s yes. It processes just fine but goes to junk e-mail box.

I suspect gmail is flagging the message as spam because the message claims to be coming from the same address that it’s being sent to (kevra83@gmail.com), but the actual address it gets sent from will be determined by the webserver that’s sending the email.

Find the email in your junk folder and click on the small arrow to the right of the reply button, and from the dropdown menu choose ‘Show original’. Gmail will open up the raw email (you’ll be able to see all the email headers and such) and look for ‘Return-Path’ and see what it’s set to… this will probably be the address that the email is sent from.
Try adding this address to the contacts for the account and see if that stops gmail from flagging the messages as spam.

I think I managed to fix the problem. Freaking GoDaddy is freaking retarded and does not allow spam e-mail filters like yahoo, gmail, hotmail, aol, etc…to be used for processing forms send to. I guess they say you have to use your domain name e-mail address lol. I tested it with the domain e-mail address and it appears to work fine. I think It’s time to close my godaddy account and go move to someone else like hostgator or someone.

Nothing Freaking about it. Basically to avoid spam mails and to track spam mail, many hosting companies add the from header as the domain header. This is the case with most hosting companies including the other that you have mentioned. Hence this is not godaddy specific but there are many hosting companies that put in such restrictions. If you go to each hosting companies site and check their FAQs you will find this in most of them that they support only emails from theemailid @ thedomainname to prevent spam

To webmasters and/or developers it can be aggravating. We know what we want the FROM to be.

But to a hosting provider, they don’t know if a site’s forms are locked down or not and they don’t want SPAM email being sent from their servers.

I have seen many threads where the OP was getting SPAM from their contact form and were dismayed to learn it was being used to send SPAM because they didn’t filter and sanitize user supplied input and it allowed header injection techniques to BCC others. (You are locking down your form aren’t you?)

If this is only for you then IMHO fretburner’s suggestion to add the address to your white list i.e. “contacts” is probably the easiest thing.

If this is for others eg. a newsletter, then you could ask them to add it to their white list. I have seen site’s ask this, but I’m not sure how good of an idea it is to rely on users to know how to do this and actually do it.

I have never used one, but AFAIK using a dedicated email service would solve the problem (and give other info like open rates), but for the added expense it might be overkill for your needs.

Dedicated services are the way to go. Especially since mandrill is free for the first 12k emails a month. You send via json rather than mailto but that is easy to consume from anything these days.