Jump to content

Form not sending email..


entreated

Recommended Posts

<?php


if(!empty($_POST)){
$to = "[email protected]";
$subject = "Precison Ceramics Questionnaire";
$name = ($_POST["name"]);
$email = ($_POST["email"]);
$first_impressions = ($_POST["first_impressions"]);
$layout = ($_POST["layout"]);
$navigation = ($_POST["navigation"]);
$general_improvements = ($_POST["general_improvements"]);
$ip =  $_SERVER['REMOTE_ADDR'];

$body = "From: $name \n
		 Email: $email \n
		 First Impressions: $first_impressions \n
		 Layout: $layout \n
		 Ease of navigation: $navigation \n
		 General improvements: $general_improvements \n
		 Ip: $ip";

if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) {
die ("Invalid Email Address"); 
}
if(empty($first_impressions) || empty($layout) || empty($navigation) || empty($general_improvements)) {
die ("You didn't fill in all the fields");
}

mail($to  $subject, $body);
header("Location: thanks.html");
exit;

}


?>

 

All errors work and it goes to the thanks page but just doesn't send an email..

 

*note* I have taken the real email address out and replaced with '[email protected] for viewing. *note*

Link to comment
https://forums.phpfreaks.com/topic/162676-form-not-sending-email/
Share on other sites

On php.net, someone said they added the following to their code:

 

ini_set('sendmail_from', '[email protected]');

mail($to  $subject, $body);

 

I do remember setting something up on my server, but it's been years since I originally coded my email scripts, and I just don't remember what else I set up.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.