Jump to content

Email is not Sending


jrws

Recommended Posts

Hey guys,

Coding something for a survey as no solution exists for our needs. I have not finished the code as I still need to do error checks + making it spam proof. Anyway I am not reciving the email even though it says that I have been sent it.

Any suggestions are appreciated, please ask if you need additional info to be able to help, and thank you in advanced.

 

 

<?php
error_reporting(0);
if(isset($_POST['submit'])){
//Check that all fields that are mandatory are filled in and that the $Email variable is real
$Title = $_POST['Title'];
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Email= $_POST['Email'];
$Country= $_POST['Country'];
$State= $_POST['State'];
$List= $_POST['List'];
$Nav= $_POST['Nav'];
$IssuesYes= $_POST['IssuesCheck'];
$IssuesList= $_POST['IssuesList'];
$Satisfaction= $_POST['Satisfaction'];
$Improvement= $_POST['Improvement'];
$ValueSatisfaction= $_POST['Value'];
$Recommendation= $_POST['Recommend'];
$Knowledge= $_POST['Knowledge'];
$Comments= $_POST['Comments'];
$Gender= $_POST['Gender'];
$Age= $_POST['Age'];
$Source= $_POST['Source'];
$ContactNumber= $_POST['Contact'];
$Newsletter= $_POST['Newsletter'];
$errors = array();
//Check that the fields above are not empty:

$to = "[email protected]";//Obviously not real one that I am sending to.
$subject = "Survey Form Submission";
$from = $to;
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$body = "$name submitted the survey form:\n".
    "This is what they responded with to each question: <br>".
"Their Name: $Title $FirstName $LastName <br>"."Email: $Email <br>"."Country: $Country <br>"."State: $State<br>"."Bought: $List<br>"."Website Navigation: $Nav<br>"."Issues: $IssuesYes " ." $IssuesList"."Satisfaction: $Satisfaction<br>"."Improvement: $Improvement<br>"."Value Satisfaction: $ValueSatisfaction<br>"."Reccomend: $Recommendation<br>"."Knowledge: $Knowledge<br>"."Comments: $Comments <br>"."Gender: $Gender<br>"."Age: $Age <br>"."Source for Finding Us: $Source <br>"."Contact: $ContactNumber<br>"."Subscribe to Newsletter?: $Newsletter<br>";
    $headers = "From: $from \r\n";
    $headers .= "Reply-To: $visitor_email \r\n";
   if( mail($to, $subject, $body,$headers)){
   echo "Email Send!";
   }else{
   echo "Somethings wrong :\ ";
   }

   // header('Location: http://www.********/thank-you-for-survey');
}


?>

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

Where are you running the script? If it's a linux based machine with postfix it could potentially be in a queue system (postfix --flush I think). Also possible that the email system is setup to not accept emails from the domain for some reason.

 

It sends just fine on my linux and windows based systems.

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.