- This topic is empty.
-
AuthorPosts
-
December 17, 2009 at 10:06 pm #27241dcp3450Participant
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: $nameEmail: $email
How did you hear about us?
$findusMessage:
$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?
December 21, 2009 at 11:14 am #68420AlCaponeParticipantI 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?December 21, 2009 at 11:26 am #68424dcp3450ParticipantWhen 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: $nameEmail: $email
How did you hear about us?
$findusMessage:
$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.
December 21, 2009 at 11:51 am #68427AlCaponeParticipantOh 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?December 21, 2009 at 12:00 pm #68428dcp3450Participantsent at random times.
the form is simple:
fill in the boxes, press send, send posts to the contact.php file.
December 21, 2009 at 12:10 pm #68431AlCaponeParticipantI 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: $nameEmail: $email
How did you hear about us?
$findusMessage:
$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.
December 21, 2009 at 12:46 pm #68434dcp3450ParticipantI 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.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.