Skip to content

Instantly share code, notes, and snippets.

Created November 20, 2014 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c1c46dfe67d1af43ed9e to your computer and use it in GitHub Desktop.
Save anonymous/c1c46dfe67d1af43ed9e to your computer and use it in GitHub Desktop.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email extends CI_Controller {
function index()
{
$email = $this->input->post('email');
$nama = $this->input->post('nama');
$subjek = $this->input->post('subjek');
$pesan = $this->input->post('pesan');
$url = $_SERVER['HTTP_REFERER'];
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'email_mu@gmail.com', //isi dengan gmailmu!
'smtp_pass' => 'password_email_mu', //isi dengan password gmailmu!
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from($email);
$this->email->to('email_mu@gmail.com'); //email tujuan. Isikan dengan emailmu!
$this->email->subject($subjek);
$this->email->message($pesan);
if($this->email->send())
{
echo 'Email sent. <a href="'.$url.'">KEMBALI</a>';
}
else
{
show_error($this->email->print_debugger());
}
}
}?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment