Codeigniter Send mail

1. Setting di config.php:
$config[‘mail’][‘protocol’] = ‘smtp’; $config[‘mail’][‘smtp_host’] = ‘ssl://smtp.googlemail.com’; $config[‘mail’][‘smtp_port’] = ‘465’; $config[‘mail’][‘smtp_user’] = ‘m.rifqi.rosyid@gmail.com’; $config[‘mail’][‘smtp_pass’] = ‘rifiqi123’; $config[‘mail’][‘mailtype’] = ‘html’; $config[‘mail’][‘starttls’] = true; $config[‘mail’][‘newline’] = “\r\n”;
2. Buat method untuk mengirim email:
private function sendEmailNotification($username, $email){ $this->load->library(’email’, $this->config->item(‘mail’)); $this->email->from(‘admin@pasbandara.com’, ‘Petugas Verificator’); $this->email->to($email); $this->email->subject(‘Notifikasi Permohonan Pas Bandara’); $content = “Salam ” . $username . “,\n\n”; $content .= “Proses pendaftaran account untuk pembuatan Pas Bandara sudah disetujui.\n\n”; $content .= “Untuk mengajukan permohonan pembuatan Pas Bandara, silakan login dengan account yang telah aktif. \n\n”; $content .= “Terimakasih,\n”; $content .= “Kepala Administrasi Bandara”; $this->email->message($content); $this->email->send(); echo $this->email->print_debugger(); }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: