1
내 로컬 호스트에서 보낸 전자 메일에 다음 코드를 작성합니다. 그것은 내 localhost에서 잘 작동하지만 서버에 파일을 업로드하면 작동이 멈췄습니다.PHP Codeigniter - 서버에서 전자 메일 기능이 작동하지 않습니다.
내 로컬 호스트에서 보낸 전자 메일에 다음 코드를 작성합니다. 그것은 내 localhost에서 잘 작동하지만 서버에 파일을 업로드하면 작동이 멈췄습니다.PHP Codeigniter - 서버에서 전자 메일 기능이 작동하지 않습니다.
이
function Sent_Confirmation_Email()
{
$this->load->library('email'); # Added
$emailid = $this->uri->segment(3);
$verificationLink = base_url() . 'MainController/Confirm_Activation/'.$emailid;
$msg .= "Thank you for creating an account with us.<br /><br /><br />";
$msg .= " Please <a href='".$verificationLink."' target='_blank'>Click Here</a> to verify your email.<br /><br /><br />";
$msg .= "Kind regards,<br />";
$msg .= "Real Animation Works.";
if(! ini_get('date.timezone'))
{
date_default_timezone_set('GMT');
}
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'password';
$config['charset'] = 'iso-8859-1'; # Added
$config['mailtype'] = 'html'; # Added
$config['wordwrap'] = TRUE;
$this->email->initialize($config); # Added
$this->email->set_newline("\r\n");
$this->email->from("[email protected]");
$this->email->to($emailid); # Changed
$this->email->subject("Email Confirmation - Courses and Tutors");
$this->email->message($msg);
if(!$this->email->send()) # Changed
{
echo $this->email->print_debugger();
}
else
{
$this->session->set_flashdata('msg', 'A confirmation email has been sent to ' . $emailid .'. Please activate your account using the link provided.');
redirect(base_url() . 'MainController/EConfirmationPage/'.$emailid); # Not sure in this part.
}
}
같이하십시오 : 나는 코드를 실행할 때 내가 오류의 스크린 샷입니다 다음
public function Sent_Confirmation_Email()
{
$emailid = $this->uri->segment(3);
$verificationLink = base_url() . 'MainController/Confirm_Activation/'.$emailid;
$msg .= "Thank you for creating an account with us.<br /><br /><br />";
$msg .= " Please <a href='".$verificationLink."' target='_blank'>Click Here</a> to verify your email.<br /><br /><br />";
$msg .= "Kind regards,<br />";
$msg .= "Real Animation Works.";
if(! ini_get('date.timezone'))
{
date_default_timezone_set('GMT');
}
$config = Array('protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'mypassword'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->set_mailtype("html");
//$this->email->isHTML(true);
$this->email->from("[email protected]");
$this->email->to("$emailid");
$this->email->subject("Email Confirmation - Courses and Tutors");
$this->email->message($msg);
if($this->email->send())
{
$this->session->set_flashdata('msg', 'A confirmation email has been sent to ' . $emailid .'. Please activate your account using the link provided.');
redirect(base_url() . 'MainController/EConfirmationPage/'.$emailid);
} else {
show_error($this->email->print_debugger());
}
}
: 다음은 내 코드입니다
첨부 된 이미지에서 "비밀번호 인증 실패"라고 표시됩니다. 이걸 확인해 봤어? –