Advertisement
Guest User

Untitled

a guest
May 13th, 2018
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. public function mailku($pekerja) {
  2. // require_once(APPPATH.'libraries/PHPMailer.php');
  3. //Server settings
  4. $tgl = date("d-m-Y H-s");
  5. $user = $this->session->userdata('NAMA');
  6.  
  7. $mail = $this->phpmailerlib->load();
  8. try {
  9. $mail->SMTPDebug = 2; // Enable verbose debug output
  10. $mail->isSMTP(); // Set mailer to use SMTP
  11. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  12. $mail->SMTPAuth = true; // Enable SMTP authentication
  13. $mail->Username = 'gema.saputera9@gmail.com'; // SMTP username
  14. $mail->Password = 'evilrose09'; // SMTP password
  15. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  16. $mail->Port = 465; // TCP port to connect to
  17. //Recipients
  18. $mail->setFrom('gema.xavier@gmail.com', 'SOLID System | PGN');
  19. $mail->addAddress('gema.xavier@gmail.com', ''.$user.''); // Add a recipient
  20. $mail->addReplyTo('gema.saputera@gmail.com', 'Gema');
  21. //$mail->addCC('cc@example.com');
  22. //$mail->addBCC('bcc@example.com');
  23.  
  24. //Attachments
  25. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  26. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  27.  
  28. //Content
  29. $mail->isHTML(true); // Set email format to HTML
  30. $mail->Subject = '[SOLID System] Penambahan pekerja baru pada '.$tgl.'';
  31. $mail->Body = '<!DOCTYPE html>
  32. <head>
  33. <title>[Penambahan Pekerja Baru]</title>
  34. </head>
  35. <body>
  36. <div style="width:100%; height:auto; padding:0px 150px; background-color:#eee;">
  37. <div>
  38. <table>
  39. <tbody>
  40. <tr style="justify-content: space-around;min-height: 70px;text-align:center;background-color:#fff;min-width: 10rem; padding:25px 100px ;" ><img width="20" src="http://3.bp.blogspot.com/-B_60B16vKDQ/UAgay8TAEeI/AAAAAAAAGK8/DdP92Mqy3Fc/s400/LOGO+BARU+PGN.png"></tr>
  41. <tr style="min-height:60px;">Nama Pekerja : '.$pekerja.'</tr>
  42. </tbody>
  43. </table>
  44. <div>
  45. </div>
  46. </body>
  47. </html>';
  48. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  49.  
  50. $mail->send();
  51. // echo 'Message has been sent';
  52. } catch (Exception $e) {
  53. echo 'Message could not be sent.';
  54. echo 'Mailer Error: ' . $mail->ErrorInfo;
  55. }
  56. }
  57.  
  58. function saveData(){
  59. $pekerja = $this->input->post('name_emp');
  60. $data = array(
  61. 'nipg'=>$this->input->post('nipg'),
  62. 'title_prefix'=>$this->input->post('title_prefix'),
  63. 'title_sufix'=>$this->input->post('title_sufix'),
  64. 'name_emp'=>$this->input->post('name_emp'),
  65. 'grade_personal'=>$this->input->post('grade_personal'),
  66. 'no_ktp'=>$this->input->post('no_ktp'),
  67. 'npwp'=>$this->input->post('npwp'),
  68. 'birth_place'=>$this->input->post('birth_place'),
  69. 'birth_date'=>$this->input->post('birth_date'),
  70. 'religion_emp'=>$this->input->post('religion_emp'),
  71. 'address_emp'=>$this->input->post('address_emp'),
  72. 'gender'=>$this->input->post('gender'),
  73. 'email'=>$this->input->post('email'),
  74.  
  75. //'status_emp'=>$this->input->post('status_emp'),
  76. 'status_assignment'=>$this->input->post('status_assignment'),
  77. 'status_active'=>$this->input->post('status_active'),
  78. 'status_nonactive'=>$this->input->post('status_nonactive'),
  79. 'date_status_nonactive'=>$this->input->post('date_status_nonactive'),
  80. 'date_position_emp'=>$this->input->post('date_position_emp'),
  81. 'date_startwork_emp'=>$this->input->post('date_startwork_emp'),
  82. 'recognize_education'=>$this->input->post('recognize_education'),
  83. 'last_education'=>$this->input->post('last_education'),
  84. 'year_of_graduate'=>$this->input->post('year_of_graduate'),
  85. 'name_univ_or_sch'=>$this->input->post('name_univ_or_sch'),
  86. 'concentration'=>$this->input->post('concentration'),
  87. 'dplk_bank'=>$this->input->post('dplk_bank'),
  88. 'dplk_bank_acc'=>$this->input->post('dplk_bank_acc'),
  89. 'bpjs_no_naker'=>$this->input->post('bpjs_no_naker'),
  90. 'date_of_personal_grade'=>$this->input->post('date_of_personal_grade'),
  91. 'date_of_personal_band'=>$this->input->post('date_of_personal_band'),
  92.  
  93. 'bpjs_no_health'=>$this->input->post('bpjs_no_health'),
  94. 'payroll_bank'=>$this->input->post('payroll_bank'),
  95. 'payroll_bank_acc'=>$this->input->post('payroll_bank_acc'),
  96. 'no_hp'=>$this->input->post('no_hp'),
  97. 'ud_ditetapkan'=>$this->input->post('ud_ditetapkan'),
  98. 'id_position'=>$this->input->post('id_position'),
  99. 'instansi '=>$this->session->userdata('INSTANSI'),
  100. //tambahan revisi
  101. 'emergency_phone'=>$this->input->post('emergency_phone'),
  102. 'kerabat'=>$this->input->post('kerabat'),
  103. 'hubungan_kerabat'=>$this->input->post('hubungan_kerabat'),
  104. 'personal_job_family_01'=>$this->input->post('personal_job_family_01'),
  105. 'personal_job_family_02'=>$this->input->post('personal_job_family_02'),
  106. 'personal_sub_family_01'=>$this->input->post('personal_sub_family_01'),
  107. 'personal_sub_family_02'=>$this->input->post('personal_sub_family_02'),
  108. 'personal_sub_family_03'=>$this->input->post('personal_sub_family_03'),
  109. 'personal_sub_family_04'=>$this->input->post('personal_sub_family_04'),
  110. 'data_tunjangan'=>$this->input->post('data_tunjangan')
  111.  
  112. );
  113.  
  114. $this->db->insert('mst_employees', $data);
  115. $this->mailku($pekerja);
  116. redirect('employee');
  117. /*echo "<pre>";
  118. print_r($data);
  119. echo "/<pre>"; */
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement