다음 code snippet을 사용하여 codeigniter를 사용하여 localhost (LAMP)에서 메일을 보내려고합니다. 그것은 "가 보낸 이메일"를 보여줍니다. 그러나 내 이메일 주소로 이메일을받지 못했습니다. 저도 같은 문제를 가지고Codeigniter에서 전자 메일을받지 못했습니다.
function sendMail() {
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]', // change it to yours
'smtp_pass' => 'xxx', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = '';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]'); // change it to yours
$this->email->to('[email protected]'); // change it to yours
$this->email->subject('testing');
$this->email->message($message);
if($this->email->send()) {
echo 'Email sent.';
}
else {
show_error($this->email->print_debugger());
}
}
확인이 라인을 사용하려면 lib에는 내가 가진 'smtp_host'=> 'SSL : //smtp.googlemail.com'. SSL 프로토콜이 올바르게 작동하지 않습니다. SMTP – ajtrichards
시도해보십시오.이 'smtp_host'=> 'smtp : //smtp.googlemail.com'. 하지만 작동하지 않습니다. – mridul
참고 : http://stackoverflow.com/a/17274496 대신'ssl : // smtp.gmail.com'을 사용해보십시오. 또한 "스팸"폴더를 확인 했습니까? –