에 등록 된 사용자에게 전자 메일을 보내면 사용자가 등록 된 후 바로 사용자에게 전자 메일을 보내는 방법을 알려줄 수 있습니다. 나는 codeigniter에 초보자입니다. 등록 양식을 제출 한 직후 이메일을 보내고 싶습니다. 어떤 도움코드 서명자
Q
코드 서명자
0
A
답변
2
$ CI = & get_instance(); $ CI-> load-> library ('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'mail.******.com';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = '*******';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html'; // or html
$config['validation'] = TRUE; // bool whether to validate email or not
$CI->email->initialize($config);
$CI->email->from('[email protected]', 'Test');
$CI->email->to('[email protected]');
$CI->email->cc('[email protected]');
$CI->email->bcc('[email protected]');
// EXP. $CI->email->bcc('[email protected],[email protected]');
$CI->email->subject('email subject');
$CI->email->message('message body');
$CI->email->send();
//echo $this->email->print_debugger();
1
당신은 이메일 클래스를 사용하는 것에 대한
<?php
class Reg_model extends CI_Model {
public function userReg($reg_fname, $reg_lname, $reg_email, $reg_pass, $reg_conpass) {
$sql = "INSERT INTO fw_registeration (reg_fname, reg_lname, reg_email, reg_pass, reg_conpass) VALUES (".$this->db->escape($reg_fname).", ".$this->db->escape($reg_lname).", ".$this->db->escape($reg_email).", ".$this->db->escape($reg_pass).", ".$this->db->escape($reg_conpass).")";
//echo $this->db->affected_rows();
if ($result = $this->db->query($sql, array($reg_fname, $reg_lname, $reg_email, $reg_pass, $reg_conpass)));
{
//echo base_url();
// $this->load->view('home');
$this->load->view('index_new');
}
}
}
?>
고맙습니다 :이 내 모델
<?php
class Registration extends CI_Controller {
public function index()
{
parent::__construct();
$this->load->view('registration_view');
}
public function userReg() {
if(extract($_POST)){
//Validation of login form
$this->form_validation->set_rules('reg_fname', 'First Name', 'required');
$this->form_validation->set_rules('reg_lname', 'Last Name', 'required');
$this->form_validation->set_rules('reg_email', 'Email', 'required|valid_email|is_unique[fw_registeration.reg_email]');
$this->form_validation->set_rules('reg_pass', 'Password', 'required|matches[reg_conpass]|min_length[6]|max_length[12]');
$this->form_validation->set_rules('reg_conpass', 'ConfirmPassword', 'required');
if($this->form_validation->run() == FALSE){
$data['reg_fname'] = $reg_fname;
$data['reg_lname'] = $reg_lname;
$data['reg_email'] = $reg_email;
$data['reg_pass'] = $reg_pass;
$data['reg_conpass'] = $reg_conpass;
$this->load->view('registration_view', $data);
}else{
//checking username and password from db
$this->load->model('reg_model');
//$login_status = $this->form_model->userLogin($user_login_name, $user_login_password);
//registeration status
$reg_status = $this->reg_model->userReg($reg_fname, $reg_lname, $reg_email, $reg_pass, $reg_conpass);
if($reg_status == true){
$data['reg_status'] = "Welcome, you logged in.";
// $this->load->view('login', $data);
}else{
$data['reg_status'] = "Login Failed. Please Try Again...";
//$this->load->view('loginsuccess', $data);
}
}
}
else{
$this->load->view('registration_view');
}
}
}
?>
입니다 :
이 내 컨트롤러입니다. https://ellislab.com/codeigniter/user-guide/libraries/email.html
일단 사용자가 데이터베이스에 있으면 다음과 같이 전자 메일을 보낼 수 있습니다. 당신은 로컬 호스트에서 이메일을 보내는 경우 ... 당신이 당신의 php.ini 파일 및 센드 메일에서 설정을 할 필요가 그렇다면 아래 코드는 당신을 위해 ... 작동
if ($result)
{
$this->load->library('email');
$this->email->from('[email protected]', 'Your Name');
$this->email->to($reg_email);
$this->email->subject('Thanks for regstering');
$this->email->message('Thank you, big lad!');
$this->email->send();
}
0
사용 ...이 노트는 작동하지 않습니다 .ini 파일 ..
if($reg_status == true){
$this->load->library('email');
$config_email['protocol'] = 'mail';
$config_email['mailtype'] = 'html';
$this->email->initialize($config_email);
$this->email->from('[email protected]', 'Your Domain');
$this->email->to($reg_email);
$this->email->subject('We welcome you');
$this->email->message("Thanks for registration");
if ($this->email->send()) {
$data['reg_status'] = "Welcome, you logged in.";
} else {
$data['reg_status'] = "SOrry registration fail";
}
//$this->load->view('login', $data);
}
관련 문제
- 1. 코드 서명자 변경 설계?
- 2. 코드 서명자 배열 문제
- 3. 코드 서명자 삽입이 실패했습니다.
- 4. 코드 서명자 확인
- 5. 코드 서명자 유효성 확인
- 6. 코드 서명자 문제
- 7. 페이지 매김이있는 코드 서명자 검색
- 8. 백본에서 코드 서명자 문제 해결
- 9. 컨트롤러에 변수를 보내고 코드 서명자
- 10. jQuery 및 코드 서명자 도움말
- 11. 코드 서명자 URL/HMVC 모호성
- 12. TCPDF가 자동으로 코드 서명자 인
- 13. 코드 서명자 모듈 상호 작용
- 14. 코드 서명자 결합이 작동하지 않습니다.
- 15. 은 코드 서명자 세션을 안전하게 보호합니까?
- 16. 코드 서명자 : 이온 인증이 작동하지 않습니다.
- 17. 문자열의 정확한 기계 가공을위한 코드 서명자 확인
- 18. 다른 모델의 코드 서명자 모델로드 및 사용
- 19. 만료 된 코드 서명자 세션은 어떻게 정리됩니까?
- 20. FaceBook 세션에서 컨트롤러가 설정되지 않았습니다. 코드 서명자
- 21. Zend Studio 자동 완성 (코드 서명자 사용)
- 22. 코드 서명자 경로를 사용하여 uri의 일부를 생략합니다.
- 23. 페이지 매김 오류가있는 코드 서명자 검색
- 24. 백본 및 코드 서명자 대기 서버 문제
- 25. 데이터 목록에 대한 코드 서명자 페이지 매기기
- 26. 필요한 유효성 검사에 영향을주는 코드 서명자 콜백
- 27. 코드 서명자 autoescapes 양식 도우미가 데이터를 양식합니까?
- 28. 중복 데이터가 코드 서명자 왼쪽으로 연결됩니다.
- 29. 서명자 정보
- 30. java.lang.SecurityException : 클래스 "org.eclipse.core.runtime.PlatformObject"의 서명자 정보가 서명자 정보와 일치하지 않습니다.
thanx 답장. 메시지 : mail() : "localhost"포트 25에서 메일 서버에 연결하지 못했습니다. php.ini에서 "SMTP"및 "smtp_port"설정을 확인하거나 ini_set()을 사용하십시오. – hash
SMTP 설정을 구성하십시오. 내가 게시 한 사용자 가이드를 읽으십시오. – Craig