$name = $_POST["name"]; $email = $_POST["email"]; $message = $_POST["message"]; echo $name; echo $email; echo $message; $EmailTo = $email; $Subject = "Message from Vimila Medicine Dispenser"; $fmail = "matrollsys@gmail.com"; // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $name; $Body .= "\n"; $Body .= "Email: "; $Body .= $email; $Body .= "\n"; $Body .= "Message: "; $Body .= $message; $Body .= "\n"; //$Body .= "Terms: "; //$Body .= $terms; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From:".$fmail); // redirect to success page if ($success && $errorMSG == ""){ echo "success"; }else{ if($errorMSG == ""){ echo "Something went wrong :("; echo $errorMSG; } else { echo $errorMSG; } } ?>