Jump to content

Form not sending email..


entreated

Recommended Posts

<?php


if(!empty($_POST)){
$to = "email@email.com";
$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@email.com for viewing. *note*

Link to comment
Share on other sites

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

 

ini_set('sendmail_from', 'me@domain.com');

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.