我试图通过我的应用程序向用户发送电子邮件,但我一直在网上工作错误
网络错误(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';
}
答案 0 :(得分:0)
问题是端口不能正常工作了 $ config [' smtp_host'] =' smtp.gmail.com&#39 ;; 相反,我把IP地址放在数字形式192.168.0.x 而端口是25而不是