0

我正在为开发站点和实时站点使用两个不同的服务器。我发送电子邮件确认的 Web 服务功能在开发站点上运行,但在 Live Site 中不运行。我的电子邮件确认功能是:

function getEmailConfirmation($UserName, $ChecklistID,$UserID,$AnswerBulkID, $TotalSubmitted){
    if ( ($UserID == '') || (!isset($UserID)) ) {
        return error("partial");
    }

    $entry = new Entry();   
    $entry_date_check = date('Y-m-d'); //for check if already
    $count_tbl_answers = $entry->listEntry("SELECT count(*) as total_from_answers FROM tbl_answers  where user_id='".$UserID."' and answer_bulk_id ='".$AnswerBulkID."' and date(ent_date) = '".$entry_date_check."' ");


    $to = "****@gmail.com"; 
    $subject = "TDL Checklist email";
    $message = "Hello there! \n User ID: ".$UserID." \n User Name: ".$UserName."\n Check List ID: ".$ChecklistID."\n Answer Bulk ID: ".$AnswerBulkID;
    $from = "TLD-Email-Confirmation";
    $headers = "From:" . $from;


    if(($count_tbl_answers[0]['total_from_answers']) == $TotalSubmitted){

        mail($to,$subject,$message,$headers);   

        $result = array(

                "user_id" => $UserID,
                "user_name"    => $UserName,
                "check_list_id"  => $ChecklistID,
                "answer_bulk_id"  => $AnswerBulkID,
            );

    } else{

         $delete_bulk = $entry->query("delete FROM tbl_answerbulk WHERE user_id ='".$UserID."' and check_list_id ='".$ChecklistID."' and id ='".$AnswerBulkID."'  ");

         $delete_answer = $entry->query("delete FROM tbl_answers WHERE user_id='".$UserID."'  and answer_bulk_id ='".$AnswerBulkID."'  ");

        return error("custom","","Could not submit your answer this time. Please try again later.");

    }

    $message = json_encode(
                $result
                );

    $fin_data['response'] = json_encode(array('Message'=>'ok','Data'=>$message));
    return $fin_data;

}

此功能在开发服务器上完美运行,但在实时服务器上不起作用。可能是什么原因?

注意: 虽然 mail 函数在 Live 站点上不起作用,但它返回的结果数组就在 mail 函数之后。那是:

    @mail($to,$subject,$message,$headers);  

    $result = array(

            "user_id" => $UserID,
            "user_name"    => $UserName,
            "check_list_id"  => $ChecklistID,
            "answer_bulk_id"  => $AnswerBulkID,
        );

我也尝试过 ini_set('smtp_port', 587);@mail($to,$subject,$message,$headers);但没有奏效。

4

0 回答 0