Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (68414 Members, 793 Products, 5353 Topic, 13045 Comments)

Cara Membuat Fitur Subcribe Newsletter di Swarakalibata V.8.0

Dibuat
Login Terakhir 1 Bulan lalu,
Telah Dilihat 1952 Kali
Andaru Abimanyu Mengatakan : Sultan Account
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2. Saya ingin tanya, bagaimana ya caranya untuk membuat fitur Subcribe Newsletter di Swarakalibata V.8.0? Jadi, ketika ada pengunjung yang sudah subcribe memasukkan e-mailnya, pada setiap berita yang baru di post otomatis akan terkirim ke e-mail pengunjung tersebut, masuk ke inbox dengan subject judul artikel, terimakash..

Ada 3 Jawaban

PHPMU.COM Support
commented on 05 Jun 2020 09:08:43
  1. Assalamualaikum,.. Subcribe intinya hanya menyimpan email ke database dan kirimkan email saat posting berita baru, bisa dilakukan dengan menambahkan table baru di database, misal table : subscribe
  2. selanjutnya dibuatkan formnya, bisa ditempel pada sidebar : application\views\phpmu-magazine\sidebar_kanan.php
  3.  
  4. <div class="widget">
  5. <h3>Subscribe</h3>
  6. <form action='<?php echo base_url(); ?>main/subscribe' method='POST'>
  7. <input type='email' name='email' class='search-input' placeholder='your-mail@domain.com'>
  8. <input type='submit' name='subscribe' value='Ikuti' style='padding:6px'>
  9. </form>
  10. </div>
  11.  
  12. Selanjutnya action simpan email subscribe ke database :
  13. CREATE TABLE `subcribe` (
  14. `id_subcribe` int(11) NOT NULL,
  15. `email` varchar(255) NOT NULL
  16. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  17.  
  18. ALTER TABLE `subcribe` ADD PRIMARY KEY (`id_subcribe`);
  19. ALTER TABLE `subcribe` MODIFY `id_subcribe` int(11) NOT NULL AUTO_INCREMENT;
  20. COMMIT;
  21.  
  22. buka file application\controllers\Main.php, tambahkan :
  23. public function subscribe(){
  24. if(isset($_POST['subscribe'])){
  25. $data = array('email'=>cetak($this->input->post('email')));
  26. $this->model_app->insert('subcribe',$data);
  27. redirect('main');
  28. }
  29. }
  30.  
  31. selanjutnya kirim email ketika posting berita baru, buka file application\controllers\Administrator.php :
  32. cari function tambah_listberita(){ tambahkan diatas redirect($this->uri->segment(1).'/listberita'); script berikut :
  33.  
  34. $email = $this->db->query("SELECT GROUP_CONCAT(email SEPARATOR ',') as email_kirim FROM `subcribe`")->row_array();
  35. $this->load->library('email');
  36. //SMTP & mail configuration
  37. $config['protocol'] = 'smtp';
  38. $config['smtp_host'] = 'ssl://smtp.googlemail.com';
  39. $config['smtp_port'] = '465';
  40. $config['smtp_timeout'] = '7';
  41. $config['smtp_user'] = 'email_anda@gmail.com'; // Alamat email gmail
  42. $config['smtp_pass'] = '******************'; //password gmail anda
  43. $config['charset'] = 'utf-8';
  44. $config['newline'] = "\r\n";
  45. $config['mailtype'] = 'html'; // or html
  46. $config['validation'] = TRUE; // bool whether to validate email or not
  47.  
  48. $this->email->initialize($config);
  49. $this->email->from('email_anda_pengirim@gmail.com', 'SWARAKALIBATA');
  50. $this->email->to($email['email_kirim']);
  51. $this->email->cc('');
  52. $this->email->bcc('');
  53.  
  54. $this->email->subject($subjek);
  55. $this->email->message($message_email);
  56. $this->email->send();
Edi Riyanto
commented on 30 Jun 2020 00:28:27
  1. Assalamualaikum,..
  2. ada tutor fotonya kah min
anonghostt
commented on 17 Apr 2022 13:13:29
  1. Assalamualaikum,.. boleh bantuannya mas $email = $this->db->query("SELECT GROUP_CONCAT(email SEPARATOR ',') as email_kirim FROM saya masih binggung di situ
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!

Online