codeigniter에서 이메일을 보내는 데 문제가 있습니다.
$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'] = "html";
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
이메일을 보낼 때 내 코드는 다음과 같습니다.
public function send_email_accountability($C11,$C12)
{
date_default_timezone_set('Asia/Manila');
$this->load->library('email');
$this->email->set_mailtype("html");
$this->email->from('[email protected]', 'company email');
$this->email->to($C11);
$this->email->subject('Accountability for'. " ". $C12);
$this->email->message("testing");
$check = $this->email->send();
//echo $this->email->print_debugger();
if ($check){
$data = "true";
}
else{
$data = "false";
}
}
MESSAGE에서 일반 텍스트로 이메일을 보낼 때 제대로 작동합니다. 하지만 문제는 HTML 스크립트로 이메일을 보낼 때 오류가 발생하지 않지만 사용자에게 보내지 않으며 MS OUTLOOK을 사용하여 이메일이 수신되지 않는다는 것입니다. 누군가이 문제로 나를 도울 수 있습니까? 감사합니다!
에서 반환 될 수있는 오류를 제공 할 수 있다면 도움이 될 echo $this->email->print_debugger();
것이므로 지금 활성화 한 다음 현재 코드를 실행하는 것이 어떻습니까?
또는 다음을 시도하십시오.
public function send_email_accountability($C11,$C12)
{
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'] = "html";
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$ci->email->initialize($config);
$ci->email->from('[email protected]', 'company email');
$ci->email->to($C11);
$ci->email->subject('Accountability for'. " ". $C12);
$ci->email->message("testing");
$check = $ci->email->send();
//echo $ci->email->print_debugger();
if ($check)
$data = "true";
else
$data = "false";
}
편집하다
"귀하의 메시지는 다음 프로토콜을 사용하여 성공적으로 전송되었습니다."를echo $ci->email->print_debugger();
반환 한다고 주석에서 언급 했으므로 단순히 스크립트에 구문 상 잘못이 없음을 의미합니다. 내가 말했듯이 내 생각은 메일 서버 문제가 될 것입니다.
이것이 내가 당신의 문제를 디버깅하는 방법이 될 것이라고 제안한다면 :
$C11
에서 Gmail 주소와 $ci->email->to($C11);
다음 실행 내 현재 스크립트와 지연의 문제가 동일한 경우를 참조하십시오.그러나 어느 쪽이든, 여전히 메일 서버 ( @ smsgt.com ) 에서 무언가를 파헤칠 것이라고 생각 합니다. 내가 당신이라면 서버 관리자에게 연락하여 메일 서버 로그에서 단서를 찾기 시작합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다