Guest User

Untitled

a guest
Aug 1st, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. Sends mail two times - codeigniter
  2. $config = Array(
  3. 'protocol' => 'smtp',
  4. 'smtp_host' => 'ssl://smtp.googlemail.com',
  5. 'smtp_port' => 465,
  6. 'smtp_user' => 'mertmetinbjk@gmail.com',
  7. 'smtp_pass' => '****',
  8. 'mailtype' => 'html'
  9. );
  10.  
  11. public function kayitOnay() {
  12.  
  13.  
  14. $username = $this->input->post('username');
  15. $email = $this->input->post('email');
  16. $password = $this->input->post('password');
  17.  
  18. $data = array();
  19.  
  20. $data['username'] = $username;
  21. $data['email'] = $email;
  22. $data['password'] = $password;
  23.  
  24. $activationCode = $this->randomString(9);
  25.  
  26. //Mail server ayarları config/email.php dosyası altında
  27.  
  28.  
  29. $this->load->library('email');
  30. $this->email->set_newline("rn");
  31.  
  32. $this->load->view('kayit/kayitOnay', $data);
  33. $this->kayitmodel->uyeEkle($username, $email, $password, $activationCode);
  34.  
  35.  
  36. $dataLink['link'] = "/kayit/kayitEmailOnay/$activationCode";
  37.  
  38. $this->email->from('bildirim@pasaj.com', 'Pasaj.com');
  39. $this->email->to('mertmetinbjk@gmail.com');
  40. $this->email->subject('Hesap Aktivasyonu');
  41. $email = $this->load->view('kayit/kayitOnayMail', $dataLink, TRUE);
  42. $this->email->message($email);
  43. $this->email->send();
  44. }
  45.  
  46. public function kayitSon() {
  47. $this->load->view("kayit/kayitTamamla");
  48. }
  49.  
  50. public function kayitHata() {
  51. $this->load->view("kayit/kayitHata");
  52. }
  53.  
  54. public function kayitEmailOnay() {
  55.  
  56. $registrationCode = $this->uri->segment(3);
  57.  
  58. if ($registrationCode == '') {
  59. echo "URLde onay kodu yok";
  60. }
  61.  
  62.  
  63. $registrationConfirmed = $this->kayitmodel->uyeOnay($registrationCode);
  64.  
  65. if ($registrationConfirmed)
  66. $this->kayitSon();
  67. else
  68. $this->kayitHata();
  69. }
Add Comment
Please, Sign In to add comment