0
여기까지 바로갑니다. codeigniter 라이브러리를 사용하여 메일을 보내려고합니다. 그러나 이메일을받지 못하고 코드에 오류가 표시되지 않습니다. 왜 작동하지 않는지 모르겠습니다. CI SMTP를 사용하여 메일 보내기
는 나는 또한이 설정을 생략 할 때, 그것은 나에게 스팸 섹션으로 직접 이동 이메일을 보내2 step verification
및
allow access to less secure apps
을 따랐습니다. 나는 그것이 스팸 섹션으로가는 이유를 모른다. 주석 링크의 답변이 작동하지 않는 경우 당신은 또한이 코드를 시도 할 수 있습니다
public function sending_email(){
// The mail sending protocol.
$config['protocol'] = 'smtp';
// SMTP Server Address for Gmail.
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
// SMTP Port - the port that you is required
$config['smtp_port'] = '465';
// SMTP Username like. ([email protected])
$config['smtp_user'] = '[email protected]';
// SMTP Password like (abc***##)
$config['smtp_pass'] = '****';
// Load email library and passing configured values to email library
$this->load->library('email', $config);
// Sender email address
$this->email->from('[email protected]', 'sample');
// Receiver email address.for single email
$this->email->to('[email protected]');
//send multiple email
//$this->email->to([email protected],[email protected],[email protected]);
// Subject of email
$this->email->subject('test');
// Message in email
$this->email->message('hello world!');
// It returns boolean TRUE or FALSE based on success or failure
echo $this->email->send();
}
smtp 서버는 'smtp.gmail.com'https://support.google.com/a/answer/176600?hl=ko이어야하며 2 단계 인증을 사용하는 경우 앱 비밀번호 (https://support.google.com/accounts/answer/185833?hl=ko)를 사용합니다. 그게 작동하는지 알려주세요. – Morfinismo
@Morfinismo가 전혀 작동하지 않습니다. 당신이 제안한 것을 시도했습니다 .. –
나는이 질문에 제공된 답변을 조사 할 것을 권장합니다. 귀하의 질문과 중복되는 것처럼 보입니다. http://stackoverflow.com/questions/1555145/sending-email-with-gmail-smtp-with-codeigniter- 전자 메일 라이브러리 – Morfinismo