1
我正在使用此代碼通過本地主機發送電子郵件。codeigniter郵件 - 我可以發送電子郵件,但我不能收到它
function send_email(){
date_default_timezone_set('Asia/Manila');
$ci =& get_instance();
$ci->load->library('email');
$config['protocol'] = "mail";
$config['smtp_host'] = "ssl://mail.smsgt.com";
$config['smtp_port'] = "25";
$config['smtp_user'] = "[email protected]";
$config['smtp_pass'] = "";
$config['charset'] = "utf-8";
$config['mailtype'] = "text";
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$ci->email->initialize($config);
$ci->email->from('[email protected]', 'company email');
$ci->email->to('[email protected]');
$ci->email->subject('test subject');
$ci->email->message("testing email");
$check = $ci->email->send();
//echo $ci->email->print_debugger();
if ($check){
echo "true";
}else{
echo "false";
}
}
它總是顯示正確,但我仍然無法收到它。我的代碼有什麼問題?還是有什麼問題?
我還是不能收到電子郵件..但謝謝你的答案。 :D –
如果沒有任何工作,您可能還會使用其他郵件服務器,這可能會很快解決問題。這裏是我使用sendmail強制CodeIgniter的代碼: $ config ['protocol'] ='sendmail'; $ config ['mailpath'] ='/ usr/sbin/sendmail'; $ this-> email-> initialize($ config); – user3804400
,給我錯誤'無法打開一個套接字到Sendmail。請檢查設置。' –