Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

Not getting email from php contact form



Im using a template from themeforest.  it comes with php email here is the code


// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
echo "No arguments Provided!";
return false;

$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];

// Create the email and send the message
$to = ''; // Add your email address inbetween the '' replacing - This is where the form will send a message to.
$email_subject = "Website Contact Form: $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From:\n"; // This is the email address the generated message will be from. We recommend using something like
$headers .= "Reply-To: $email_address";
return true;


it also has contact.js heres the code


$(function() {

$("#contactForm input,#contactForm textarea").jqBootstrapValidation({
preventSubmit: true,
submitError: function($form, event, errors) {
// additional error messages or events
submitSuccess: function($form, event) {
// Prevent spam click and default submit behaviour
$("#btnSubmit").attr("disabled", true);

// get values from FORM
var name = $("input#name").val();
var email = $("input#email").val();
var phone = $("input#phone").val();
var message = $("textarea#message").val();
var firstName = name; // For Success/Failure Message
// Check for white space in name for Success/Fail message
if (firstName.indexOf(' ') >= 0) {
firstName = name.split(' ').slice(0, -1).join(' ');
url: "././mail/contact_me.php",
type: "POST",
data: {
name: name,
phone: phone,
email: email,
message: message
cache: false,
success: function() {
// Enable button & show success message
$("#btnSubmit").attr("disabled", false);
$('#success').html("<div class='alert alert-success'>");
$('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
$('#success > .alert-success')
.append("<strong>Your message has been sent. </strong>");
$('#success > .alert-success')

//clear all fields
error: function() {
// Fail message
$('#success').html("<div class='alert alert-danger'>");
$('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
$('#success > .alert-danger').append("<strong>Sorry " + firstName + ", it seems that my mail server is not responding. Please try again later!");
$('#success > .alert-danger').append('</div>');
//clear all fields
filter: function() {
return $(this).is(":visible");

$("a[data-toggle=\"tab\"]").click(function(e) {

// When clicking on Full hide fail/success boxes
$('#name').focus(function() {



Not sure why im not receiving email when logging into cpanel email.  can anyone help?  thanks!!!

Community Manager
Community Manager

Re: Not getting email from php contact form

Hi @samplemaniak. Thanks for being part of GoDaddy Community! I wouldn't be able to comment on your PHP code. However, isn't using an MX record that I'm familiar with. If your email is hosted on cPanel, you should only have a MX record. If you're using mail elsewhere but the site is also hosted on cPanel, that could also be an issue depending on your accounts MX Entry settings. Those are two things you can check. Hope that helps. If not, feel free to provide more information. Others in the community may be able to provide you with additional suggestions.


JesseW - GoDaddy | Community Manager | 24/7 support available at | Remember to choose a solution and give kudos.