简体   繁体   中英

Not able to send mail on Godaddy webmail using php contact form

I have created one contact form in php, its perfectly working for gmail but while I am trying to send mail on godaddy webmail status showing successfully sent, But mail not coming in my godaddy webmail box. Here is my code.

<?php
        if(isset($_POST['Submit_mail'])){

        $name=trim($_POST["name"]);
        $number=trim($_POST["number"]);
        $email=trim($_POST["email"]);
        $msg=trim($_POST["msg"]);
        $catalogue=trim($_POST["catalogue"]);

        if($name == "" ) {
        $error= "error : You did not enter a name.";
        $code= "1" ;
        }

        elseif($number == "" ) {
        $error= "error : Please enter number.";
        $code= "2";
        }

        //check if the number field is numeric
        elseif(is_numeric(trim($_POST["number"])) == false ) {
        $error= "error : Please enter numeric value.";
        $code= "2";
        }

        elseif(strlen($number)<10) {
        $error= "error : Number should be 10 digits.";
        $code= "2";
        }

        //check if email field is empty
        elseif($email == "" ) {
        $error= "error : You did not enter a email.";
        $code= "3";
        } //check for valid email

        elseif(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)) {
        $error= 'error : You did not enter a valid email.';
        $code= "3";
        }

        elseif($msg == "" ) {
        $error= "error : Please enter Product Description.";
        $code= "4";
        }

        else{
        $message='my message ';


        $headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";



        if(mail('mywebmailid','You have a new quote request from client',$message,$headers))
        {
        //header("Location:index.php?status=true");
        echo "Success";
        }
        else
        {
        //header("Location:index.php?status=false");
        echo "fail";
        }



        }

        }
        ?>

Godaddy seems to have broken their php mail() command in December 2016. I am trying to solve the problem myself. It worked until mid December, while I was away on holiday, and I just was informed by my staff no emails come through anymore. No errors, php mail() responds with success.

Godaddy changed something and they have not told me what they changed! Annoying, they do this too much, likely moving to a new host soon as my terms are up.

If I can identify the problem I will post it here for you.

What does still work is the godaddy formmail and gdform functions that are built into your hosting account. These are quite ugly, and cannot be customized and only one email address will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM