[eluser]Unknown[/eluser]
Hi there,
i face two problems and could not solve them.
I send email to users for registration.However, it sends email two times
Here is the code
Code:
public function kayitOnay() {
$username = $this->input->post('username');
$email = $this->input->post('email');
$password = $this->input->post('password');
$data = array();
$data['username'] = $username;
$data['email'] = $email;
$data['password'] = $password;
$activationCode = $this->randomString(10);
$this->load->view('kayit/kayitOnay', $data);
$this->kayitmodel->uyeEkle($username, $email, $password, $activationCode);
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => '********',
'mailtype' => 'html'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$dataLink['link'] = "/kayit/kayitEmailOnay/$activationCode";
$this->email->from('[email protected]', 'Pasaj.com');
$this->email->to('[email protected]');
$this->email->subject('Hesap Aktivasyonu');
$email = $this->load->view('kayit/kayitOnayMail', $dataLink, TRUE);
$this->email->message($email);
$this->email->send();
}
and in email i use kayitOnayMail template as you see above i send a link to this template to complete the registration process
but when user click it it sends kayitOnay why :S This is the code of it
Code:
public function kayitEmailOnay() {
$registrationCode = $this->uri->segment(3);
if ($registrationCode == '') {
echo "URLde onay kodu yok";
}
$registrationConfirmed = $this->kayitmodel->uyeOnay($registrationCode);
if ($registrationConfirmed)
echo "oke";
else
$this->load->view('kayit/kayitHata');
}