【问题标题】:Not able to send mail on Godaddy webmail using php contact form无法使用 php 联系表在 Godaddy webmail 上发送邮件
【发布时间】:2017-01-15 06:32:05
【问题描述】:

我在 php 中创建了一个联系表单,它非常适用于 gmail,但是当我尝试发送邮件时,godaddy webmail 状态显示已成功发送,但邮件没有进入我的 godaddy 网络邮箱。 这是我的代码。

<?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";
        }



        }

        }
        ?>

【问题讨论】:

    标签: php forms contact webmail


    【解决方案1】:

    Godaddy 似乎在 2016 年 12 月破坏了他们的 php mail() 命令。我正在尝试自己解决问题。它一直工作到 12 月中旬,当时我正在度假,我的员工刚刚通知我,没有任何电子邮件收到了。没有错误,php mail() 响应成功。

    Godaddy 改变了一些东西,但他们没有告诉我他们改变了什么!烦人,他们这样做太多了,可能会在我的条款到期后立即转移到新的主机。

    如果我能确定问题,我会在这里为您发布。

    仍然有效的是您的主机帐户中内置的 godaddy formmail 和 gdform 功能。这些非常丑陋,并且无法自定义,并且只有一个电子邮件地址可以使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-27
      • 1970-01-01
      相关资源
      最近更新 更多