So I I filled out a form and i used my own email on the php, but I am not receiving an email?
http://f13-preview.awardspace.net/groupeezz.dx.am/groupeezz2/index.html
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$zip = $_POST["zip"];
$message = $_POST["message"];
$EmailTo = "sandychow415@gmail.com";
$Subject = "New Message Received";
// Prepare email body text
$Body .= "Name";
$Body .= "$name";
$Body .= "\n";
$Body .= "Email";
$Body .= "$email";
$Body .= "\n";
$Body .= "Zip";
$Body .= "$zip";
$Body .= "\n";
$Body .= "Message";
$Body .= "$message";
$Body .= "\n";
// Send Email
$success = mail($EmailTo, $Subject, $Body, "From:".$email);
// Redirect to Success Page
if ($success && $errorMSG == "") {
echo "success";
} else {
if ($errorMSG == ""){
echo "Something went wrong. :( Please try again.";
} else {
echo $errorMSG;
}
}
$errorMSG = "";
// Name
if (empty($_POST["name"])) {
$errorMSG = "Your name is required ";
} else {
$name = $_POST["name"];
}
// Email
if (empty($_POST["email"])) {
$errorMSG = "Your Email is required ";
} else {
$email = $_POST["email"];
}
// Name
if (empty($_POST["zip"])) {
$errorMSG = "Your zip code is required ";
} else {
$zip = $_POST["zip"];
}
// Name
if (empty($_POST["message"])) {
$errorMSG = "Your message is required ";
} else {
$message = $_POST["message"];
}
?>
Is your environment configured to allow you to send emails? And will it allow you to send emails using whatever “from” address the user enters into your form? That would mean that your mail server could be used to send emails using my address as the from-address, which may be an issue. I thought most proper commercial mail servers wouldn’t do that. When you say you used your own email in the PHP, did you also use a known good email address as the “from” address? Really you should use your own email address as the “from” address, and add the users email into the message text, maybe with a “reply-to” header to make it easy to respond.
Also you seem to be checking for whether the user entered any information after you’ve already sent the email. Is that intentional? You also check for whether the “validation” has thrown any errors, before you run that validation.
Sorry I don’t quite understand your question. I am not trying to send emails. I want people to fill out the form. like their contact, name, phone number email, and message. I don’t want to send anyone an email. I want to received the email that I got all their information and message.
Yes you are. You’re sending a single email from whatever server is running your PHP code, to yourself. This bit of code
// Send Email
$success = mail($EmailTo, $Subject, $Body, "From:".$email);
sends an email. Or doesn’t, from what you said in the first post.
So it might be that the server you’re running this stuff on isn’t configured to send emails, or several other things. Does the check on $success suggest that the email has been sent, but you just don’t receive it?
my server is configured to send emails. The php says success but I don’t receive an email from them. Im trying to fill out the form and receive and collect the information that the user has sent to the email.
perhaps your email server or your email program considers the source to be spam and is blocking it
When you fill out the form, what email address do you enter? One that exists, and your server is configured to accept?