• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

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

    Contact form using PHP not sending email

    Hello, I was trying to create a contact page using php. however it didnt work..

     

    I didn't receive any email.

    I'm sure my code runs well..

    I used mail() and it produces true, but no email received.

    what should i do

    3 ACCEPTED SOLUTIONS

    Accepted Solutions
    Highlighted
    Helper VI
    Helper VI
    Solution

    Re: Contact form using PHP not sending email

    Hello.

    Maybe this will help you: https://uk.godaddy.com/help/using-our-php-form-mailers-on-web-and-classic-hosting-8376

     

    Good luck.

     

    ***Signature: -> Do not assume anything! If you want help, explain your problem. If my post helped you, give it a Kudo. If you have the solution, mark the topic as Solved.

    View solution in original post

    Highlighted
    Solution

    Re: Contact form using PHP not sending email

    This was marked as solved, but the posted solution didn't work for me. I was able to solve my issue, so I'll share what I did. If you use the Office365 email account purchased with your domain, and you want the php in your code to send emails to that address via a form, then you have to make sure the MX entry on the domain server matches the MX entry in on the hosting server. Here's what you do:

     

    1. Login to your GoDadday account, and click on "My Products"

    2. Find your target domain and click on the "DNS" button

    3. Scroll down until you see the entry row for "MX" and find the "Value" column

    4. Copy this part of the entry to your clipboard. (should be some kind of web address)

    5. Open a new tab and login to cpanel (...yourdomain/cpanel)

    6. Scroll to the bottom to find the "Email" section. Click "MX Entry"

    7. Make sure "Remote Mail Exchanger" radio button is selected. If not, select it and click change. (*** This is important before changing the MX entry***)

    8. At the bottom,under "MX Records", click edit (or add a new one if it doesn't already exist).

    9. Replace the "Destination" by pasting what you copied from the GoDaddy DNS manager.

    10. Click "Edit". Now you're done.

     

    The "MX record" should now match whatever was in the "Value" column of the MX entry from the DNS manager, and your form should work. I would imagine the same thing would work for any remote email server (e.g. Google), as long as the MX entries match. I hope this helps the rest of you who still can't get the email form on your site to work. 

    View solution in original post

    Highlighted
    Solution

    Re: Re: Contact form using PHP not sending email

    When you get to the DNS Manager, look at the bottom right hand corner of the page. You will see (in green) ADD. Click on this and it allows you to add a new record.

    View solution in original post

    14 REPLIES 14
    Highlighted
    Helper VI
    Helper VI
    Solution

    Re: Contact form using PHP not sending email

    Hello.

    Maybe this will help you: https://uk.godaddy.com/help/using-our-php-form-mailers-on-web-and-classic-hosting-8376

     

    Good luck.

     

    ***Signature: -> Do not assume anything! If you want help, explain your problem. If my post helped you, give it a Kudo. If you have the solution, mark the topic as Solved.

    View solution in original post

    Highlighted

    Re: Contact form using PHP not sending email

    I am using GoDaddy for my email service and I have a custom website hosted on a GoDaddy Linux plan. My site has a webform that uses a php processing page to send the form results to my email address at GoDaddy. The problem is that I never receive the form results at my GoDaddy email address. I am able to receive the form results at a gmail address, a Yahoo email address and an Sbcglobal email address, so I know the form and processing code is correct.. Anyone have any idea as to what could be the issue?

    Thank you in advance for you help.

    Highlighted

    Re: Contact form using PHP not sending email

    Actually my website is based on wordpress and woocommerce.There was everything ok but one month ago i realized that customer was not getting email so i talk to goddady support team ,they told me it is malware or sql injection in your website so ,i created new website with new database but problem is not resolved so far.

    Here is problem description:

    If customer fill the contact form in https://www.gsm-support.co.uk/contact-gsm-support-london/

    Admin is able to get email but customer is not.Same code was working earlier.I have nothing changed in code.So what could be the problem i have check many things .I  have also talk to support team they provide me some instruction for get update all the plugins,theme and password and i did but no positive result.

    Please help me as soon as possible.

    Thanks & Regards

    Petar Petrov 

    Highlighted

    Re: Contact form using PHP not sending email

    Hi Thurman123  are you able to get email on gmail or yahoo apart from hosting email ?

    If No then please set your email header information properly and check php mail() function 

    http://php.net/manual/en/function.mail.php

    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to, $subject, $message, $headers);

    Otherwise set email configuration 

     

    Cheers 🙂

    Highlighted

    Re: Contact form using PHP not sending email

    I have a web form that I am not getting the emails from. I have tried using my formmail script as well as GoDaddy's webformmail.php. The form isnt giving any errors, I just stopped receiving earlier this week.

     

    www.blountrentals.com/contact.php

     

    Highlighted
    New

    Re: Contact form using PHP not sending email

    I am using PHPMailer to send mail from contact form. I can send mail using this class from my local development server. But mail not send from production(godaddy hosting).

     

    My code 

    -----------------------------------------

    $mail = new PHPMailer ();

    $mail->isSMTP();

    $mail->Host = 'smtp.gmail.com';

    $mail->Port = 587;

    $mail->SMTPSecure = 'tls';

    $mail->SMTPAuth = true;

    $mail->Username = "xxxxxxxxxx@gmail.com";

    $mail->Password = "xxxxxxxxx";

     

    $mail->setFrom($email, $name);

    $mail->addReplyTo($email, $name);

    $mail->addAddress('xxxxxxxxxxxxx@gmail.com', $name);

    $mail->Subject = $subject;

    $mail->Body    = $message;

    if (! $mail->send ()) {

    return "Mailer Error : " . $mail->ErrorInfo;

    // return 'Mailer Error : ' . 'error in send mail. Please try after sometime';

    } else {

    return 'Message sent successfully!!!';

    }

     

    This is important feature of my website. Please resolve this issue ASAP.

     

    Thanks,

    Subashini R. 

    Highlighted

    Re: Contact form using PHP not sending email

    Hi,

     

    I have a contact form on my website and I can see by going to my WordPress Dashboard and clicking Forms/Submissions that the messages are coming through. However they are not coming to my email address. I can't see anywhere in any of the settings which email they should be going to. Where would I find this setting?

     

    The Contact Widget is the standard one that came with the Domain from GoDaddy it is not using an additional installed Plugin.

     

    Many thanks

     

    Michelle

      

    Highlighted
    Solution

    Re: Contact form using PHP not sending email

    This was marked as solved, but the posted solution didn't work for me. I was able to solve my issue, so I'll share what I did. If you use the Office365 email account purchased with your domain, and you want the php in your code to send emails to that address via a form, then you have to make sure the MX entry on the domain server matches the MX entry in on the hosting server. Here's what you do:

     

    1. Login to your GoDadday account, and click on "My Products"

    2. Find your target domain and click on the "DNS" button

    3. Scroll down until you see the entry row for "MX" and find the "Value" column

    4. Copy this part of the entry to your clipboard. (should be some kind of web address)

    5. Open a new tab and login to cpanel (...yourdomain/cpanel)

    6. Scroll to the bottom to find the "Email" section. Click "MX Entry"

    7. Make sure "Remote Mail Exchanger" radio button is selected. If not, select it and click change. (*** This is important before changing the MX entry***)

    8. At the bottom,under "MX Records", click edit (or add a new one if it doesn't already exist).

    9. Replace the "Destination" by pasting what you copied from the GoDaddy DNS manager.

    10. Click "Edit". Now you're done.

     

    The "MX record" should now match whatever was in the "Value" column of the MX entry from the DNS manager, and your form should work. I would imagine the same thing would work for any remote email server (e.g. Google), as long as the MX entries match. I hope this helps the rest of you who still can't get the email form on your site to work. 

    View solution in original post

    Highlighted

    Re: Contact form using PHP not sending email

    The king_sarge MX record fix (below) worked for me. I appreciate you taking the time to document your fix. THANK YOU!!!


    @king_sarge wrote:

    This was marked as solved, but the posted solution didn't work for me. I was able to solve my issue, so I'll share what I did. If you use the Office365 email account purchased with your domain, and you want the php in your code to send emails to that address via a form, then you have to make sure the MX entry on the domain server matches the MX entry in on the hosting server. Here's what you do:

     

    1. Login to your GoDadday account, and click on "My Products"

    2. Find your target domain and click on the "DNS" button

    3. Scroll down until you see the entry row for "MX" and find the "Value" column

    4. Copy this part of the entry to your clipboard. (should be some kind of web address)

    5. Open a new tab and login to cpanel (...yourdomain/cpanel)

    6. Scroll to the bottom to find the "Email" section. Click "MX Entry"

    7. Make sure "Remote Mail Exchanger" radio button is selected. If not, select it and click change. (*** This is important before changing the MX entry***)

    8. At the bottom,under "MX Records", click edit (or add a new one if it doesn't already exist).

    9. Replace the "Destination" by pasting what you copied from the GoDaddy DNS manager.

    10. Click "Edit". Now you're done.

     

    The "MX record" should now match whatever was in the "Value" column of the MX entry from the DNS manager, and your form should work. I would imagine the same thing would work for any remote email server (e.g. Google), as long as the MX entries match. I hope this helps the rest of you who still can't get the email form on your site to work. 


     

    Highlighted

    Re: Contact form using PHP not sending email

    Thanks king-sarge...unfortunately, Go-daddy have changed the site so there is no more Add/edit option, it just says "mange mx records", which just takes you right out of Cpanel back to the main Godaddy DNS manager page, the exact same page in your steps 2 and 3 where we copied from, so stuck in a loop!

    Highlighted

    Re: Contact form using PHP not sending email

    I am having the same issue with the mail() function on my site as well. I wish i could follow sarge's suggestion however the site has changed and now it just brings you back to the DNS page.

    Sarge...where are you buddie?? lol, hope you get a notification and hurry back.

    I've tested the script on other hosts and it works without a hitch, I have even stripped it down to hard set values within the php script so it doesn't care what is entered into the form, once submit is hit it will use these values and try to send.

    $email = 'validemail@mydomain.ca' . "\r\n";
    $subject = 'Simple test' . "\r\n";
    $body = 'Simple test' . "\r\n";
    $header = 'From: validemail@mydomain.ca' . "\r\n";
    $header .= 'Reply-To: validemail@mydomain.ca' . "\r\n";

    mail($email,$subject,$body,$header);

     

    NOTE: I've also added an echo statement to ensure it is correct and the mail() function returns "1" when run through a true false check.

     

    If someone can fully detail how to get this going, I'm sure many would be HIGHLY appreciative! I've gotten the same run around from GoDaddy support... either it's "We're not sure, but it looks like it's your script that isn't working" or "Should be working, here is a template that works for us..."

    Their template is using the same code I have listed here... so it has to be a settings issue.

    Highlighted
    New

    Re: Contact form using PHP not sending email

    Hi guys

    please cancel immediately the credit car charges for my auto renewal email package because i never use your email service

    i use other hosting

    thx

    Said


    @xinyiwrote:

    Hello, I was trying to create a contact page using php. however it didnt work..

     

    I didn't receive any email.

    I'm sure my code runs well..

    I used mail() and it produces true, but no email received.

    what should i do


     

    Highlighted
    Solution

    Re: Re: Contact form using PHP not sending email

    When you get to the DNS Manager, look at the bottom right hand corner of the page. You will see (in green) ADD. Click on this and it allows you to add a new record.

    View solution in original post

    Highlighted

    Re: Contact form using PHP not sending email

    You're a life saver!!! Its really sad that the people Go Daddy employs and pays know nothing surrounding the services they provide. I was on the phone with them many times insisting that its a setting in the go daddy environment and not the form itself.. Each time they rushed me off the phone..