Scroll to top

Haloo! Selamat Datang di Komunitas Private Training Web Development (33974 Members, 291 Projects, 2983 Topic, 8320 Comments)

Butuh karyawan baru? atau seorang Web Developer (Part-time/Freelance/Full-time) untuk mengerjakan project/aplikasi anda?, cari disini : Members Area Jobs!
Kirim Pesan Menu Hubungi Kami Ke Email admin di Swarakalibata CI
Simri nubatonis Mengatakan : Members -
  1. Pak Robby,
  2. Mohon bantuannya
  3. Mau tanya, kalo misalnya pesan di form hubungi kami itu saat kirim, terkirim ke email dan admin gmana caranya?
  4. Atau mungkin ada teman-teman yang bisa please share (kalo berkenan)
  5. Thanks sebelumnya
  6.  
  7.  
Robby Prihandaya Mengatakan :
Admin -
  1. Assalam, bisa buka dulu file "application/controller/hubungi.php"
  2. Selanjutnya di dalam function kirim() tambahkan fungsi mengirim email,..
  3.  
  4. $this->load->library('email');
  5. $email_admin = $data['alamat_email_admin'];
  6. $email_pengirim = $this->input->post('email_pengirim');
  7. $subject = 'Subject Pesan disini ...';
  8. $message = "Isi Pesan disini,..";
  9.  
  10. $this->email->from($email_pengirim , 'Si Pengirim');
  11. $this->email->to($email_admin);
  12. $this->email->cc('');
  13. $this->email->bcc('');
  14.  
  15. $this->email->subject($subject);
  16. $this->email->message($message);
  17. $this->email->set_mailtype("html");
  18. $this->email->send();
  19.  
  20. $config['protocol'] = 'sendmail';
  21. $config['mailpath'] = '/usr/sbin/sendmail';
  22. $config['charset'] = 'utf-8';
  23. $config['wordwrap'] = TRUE;
  24. $config['mailtype'] = 'html';
  25. $this->email->initialize($config);
  26.  
  27. Silahkan sesuaikan, dan selanjutnya coba kirim pesan,
  28. dan insyaallah akan masuk ke email si admin juga,.. :)

Simri nubatonis Mengatakan :
Members -
  1. Pak Robby,
  2.  
  3. Saya coba tapi ko belum berhasil ya? Apa mungkin saya salah nempatin scriptnya ?
  4. Saya coba OFF LINE dan online, tapi belum berhasil
  5. Kalo di off line saya sudah coba aktifin di php.ini untuk kirim email yang ini:
  6. ;SMTP = localhost jadi gini: SMTP = localhost
  7. Saya lampirkan file Hubungi [application/controller/Hubungi.php]
  8. Thanks pak Robby
  9.  

Ada 1 File Kiriman :
1. Hubungi.zip (1 KB)
Andri darmawan Mengatakan :
Members -
  1. Assalam,..
  2. sudah saya coba dan berhasil silahkan sperti ini untuk controller hubungi.php
  3.  
  4. <?php
  5. defined('BASEPATH') OR exit('No direct script access allowed');
  6. class Hubungi extends CI_Controller {
  7. public function index(){
  8. $query = $this->model_utama->view_where('mod_alamat',array('id_alamat' => 1));
  9. $data['iden'] = $this->model_utama->view_where('identitas',array('id_identitas' => 1))->row_array();
  10. $row = $query->row_array();
  11. $data['title'] = 'Hubungi Kami';
  12. $data['description'] = 'Silahkan Mengisi Form Dibawah ini untuk menghubungi kami';
  13. $data['keywords'] = 'hubungi, kontak, kritik, saran, pesan';
  14. $data['rows'] = $row;
  15.  
  16. $this->load->helper('captcha');
  17. $vals = array(
  18. 'img_path' => './captcha/',
  19. 'img_url' => base_url().'captcha/',
  20. 'font_path' => './asset/Tahoma.ttf',
  21. 'font_size' => 17,
  22. 'img_width' => '150',
  23. 'img_height' => 45,
  24. 'border' => 0,
  25. 'word_length' => 5,
  26. 'expiration' => 7200
  27. );
  28.  
  29. $cap = create_captcha($vals);
  30. $data['image'] = $cap['image'];
  31. $this->session->set_userdata('mycaptcha', $cap['word']);
  32. $this->template->load(template().'/template',template().'/hubungi',$data);
  33. }
  34.  
  35. function kirim(){
  36.  
  37. $this->load->library('email');
  38. $email_admin = $data['alamat_email_admin'];
  39. $email_pengirim = $this->input->post('email_pengirim');
  40. $subject = 'Subject Pesan disini ...';
  41. $message = "Isi Pesan disini,..";
  42.  
  43. $this->email->from($email_pengirim , 'Si Pengirim');
  44. $this->email->to($email_admin);
  45. $this->email->cc('');
  46. $this->email->bcc('');
  47.  
  48. $this->email->subject($subject);
  49. $this->email->message($message);
  50. $this->email->set_mailtype("html");
  51. $this->email->send();
  52.  
  53. $config['protocol'] = 'sendmail';
  54. $config['mailpath'] = '/usr/sbin/sendmail';
  55. $config['charset'] = 'utf-8';
  56. $config['wordwrap'] = TRUE;
  57. $config['mailtype'] = 'html';
  58. $this->email->initialize($config);
  59.  
  60. if (isset($_POST['submit'])){
  61. if ($this->input->post() && (strtolower($this->input->post('security_code')) == strtolower($this->session->userdata('mycaptcha')))) {
  62. $data = array('nama'=>cetak($this->input->post('a')),
  63. 'email'=>cetak($this->input->post('b')),
  64. 'subjek'=>$_SERVER['REMOTE_ADDR'],
  65. 'pesan'=>cetak($this->input->post('c')),
  66. 'tanggal'=>date('Y-m-d'),
  67. 'jam'=>date('H:i:s'));
  68. $this->model_utama->insert('hubungi',$data);
  69. echo $this->session->set_flashdata('message', '<div class="alert alert-success"><center>Pesan terkirim!, akan kami respon via email!</center></div>');
  70. }else{
  71. echo $this->session->set_flashdata('message', '<div class="alert alert-danger"><center>Security Code yang anda masukkan salah!</center></div>');
  72. }
  73. redirect('hubungi');
  74. }
  75. }
  76.  
  77.  
  78.  
  79. }
  80.  

Maaf, Untuk Memberikan Komentar Anda Harus Login !!!