Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Empty emails

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #27241
    dcp3450
    Participant

    I use a simple contact form with the mail() function:

    Code:
    $name = $_POST[“name”];
    $email = $_POST[“email”];
    $findus = $_POST[“hear”];
    $subject = $_POST[“subject”];
    $body = $_POST[“body”];

    $content = ”
    Name: $name

    Email: $email

    How did you hear about us?
    $findus

    Message:
    $body”;

    $send = mail( “clientsEmailAddress”, “$subject”, $content, “from: $email” );

    if($send)
    header(“location: confirm_contact.php”);
    else
    header(“location: error_contact.php”);

    however, my client is getting blank emails from what seems to be the web server. they have no subjects either, even though on my contact form that isn’t an option. The emails look like this:

    From: <[email protected]>
    Date: Thu, Dec 17, 2009 at 9:24 PM
    Subject:
    To: [email protected]

    Name:

    Email:

    How did you hear about us?

    Message:

    the DNS is prod.****.secureserver.net. I assumed the server was causing an issue so I called them and was told the issue was with my form and/or php.

    Anyone else ever see this issue?

    #68420
    AlCapone
    Participant

    I can’t see exactly what the code is as its to small and i don’t want to have to copy and paste it somewhere else to read it.
    But at a brief glance i think your problem lies where your message is being assembled.
    I think you have
    $content = " Name: $Name rest off text… ";
    I think it should be,
    $content = " Name:".$Name." rest off text… ";
    Do you understand what i mean?

    #68424
    dcp3450
    Participant

    When the form is filled out it works fine. These aren’t emails sent by people trying to contact the client it’s seems to come from his server.

    $name = $_POST["name"];
    $email = $_POST["email"];
    $findus = $_POST["hear"];
    $subject = $_POST["subject"];
    $body = $_POST["body"];

    $content = "
    Name: $name

    Email: $email

    How did you hear about us?
    $findus

    Message:
    $body";

    $send = mail( "clientsEmailAddress", "$subject", $content, "from: $email" );

    if($send)
    header("location: confirm_contact.php");
    else
    header("location: error_contact.php");

    All info is correct when you fill out the form. He’s just getting random blank emails that have the form elements from the body just no text or subject.

    #68427
    AlCapone
    Participant

    Oh ok, i get you.
    Are these blank emails sent together when the form has been filled out, so the client recieves one filled out email and one blank, or do they receive them at completely random times?
    All that code looks fine to me…
    Whats your forms code?

    #68428
    dcp3450
    Participant

    sent at random times.

    the form is simple:

    fill in the boxes, press send, send posts to the contact.php file.

    #68431
    AlCapone
    Participant

    I have no idea whats causing it then, if i was you i would try and validate the data in the php file first.
    So try this,

    if ($_POST["name"] != "") {

    $name = $_POST["name"];
    $email = $_POST["email"];
    $findus = $_POST["hear"];
    $subject = $_POST["subject"];
    $body = $_POST["body"];

    $content = "
    Name: $name

    Email: $email

    How did you hear about us?
    $findus

    Message:
    $body";

    $send = mail( "clientsEmailAddress", "$subject", $content, "from: $email" );

    if($send)
    header("location: confirm_contact.php");
    else
    header("location: error_contact.php");

    }

    I typed that first line off the top of my head so you might need to check it.

    #68434
    dcp3450
    Participant

    I have an statement in there to check for missing name, subject, etc. I just left it out of the post since I thought it would be trivial to the issue.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.