簡體   English   中英

從php應用程序發送電子郵件

[英]sending email from php application

我正在嘗試通過我的應用程序向用戶發送電子郵件,但我一直收到網絡錯誤

網絡錯誤(tcp_error)

發生通信錯誤:“操作超時” Web服務器可能已關閉,太忙或遇到其他問題,導致其無法響應請求。 您不妨稍后再試。

要獲得幫助,請與您的網絡支持團隊聯系。

  if ($send_email == 'on') {

                            //$this->_send_mail($row['mem_real_name'], $m_title, $meeting_id, $row['mem_email']);
                        $config['protocol'] = 'smtp';
                        $config['smtp_host'] = 'smtp.gmail.com';
                        $config['smtp_user'] = 'admin';
                        $config['smtp_pass'] = 'xxxxx';
                        $config['smtp_port'] = '465';

                        $this->load->library('email');
                        $this->email->initialize($config);

                        $this->email->from('someone@gmail', 'mamoun');
                        $this->email->to('someone@gmail.com'); 
                        $this->email->subject('Email Test');
                $this->email->message('Testing the email class.');  

                $this->email->send();

echo $this->email->print_debugger();    


                        }

我也嘗試過此代碼...相同的錯誤

    $from_add = "xyz@kku.edu.sa";
        $to_add = "someonme@kku.edu.sa";
        $subject = "test"; 
        $message = "teest";
        $headers = "From: $from_add \r\n";
        $headers .= "Reply-To: $from_add \r\n";
        $headers .= "Return-Path: $from_add\r\n";
        $headers .= "X-Mailer: PHP \r\n";
//$headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=Windows-1256" . "\r\n";

        if (mail($to_add, $subject, $message, $headers)) {
        echo 'good';

        } else {

            echo 'nooo';
        }

問題是端口不起作用,並且$ config ['smtp_host'] ='smtp.gmail.com'; 相反,我將IP地址以數字形式192.168.0.x設置,端口改為25

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM