Created
November 20, 2014 10:02
-
-
Save anonymous/c1c46dfe67d1af43ed9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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