Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function mailku($pekerja) {
- // require_once(APPPATH.'libraries/PHPMailer.php');
- //Server settings
- $tgl = date("d-m-Y H-s");
- $user = $this->session->userdata('NAMA');
- $mail = $this->phpmailerlib->load();
- try {
- $mail->SMTPDebug = 2; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'gema.saputera9@gmail.com'; // SMTP username
- $mail->Password = 'evilrose09'; // SMTP password
- $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 465; // TCP port to connect to
- //Recipients
- $mail->setFrom('gema.xavier@gmail.com', 'SOLID System | PGN');
- $mail->addAddress('gema.xavier@gmail.com', ''.$user.''); // Add a recipient
- $mail->addReplyTo('gema.saputera@gmail.com', 'Gema');
- //$mail->addCC('cc@example.com');
- //$mail->addBCC('bcc@example.com');
- //Attachments
- //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
- //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
- //Content
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = '[SOLID System] Penambahan pekerja baru pada '.$tgl.'';
- $mail->Body = '<!DOCTYPE html>
- <head>
- <title>[Penambahan Pekerja Baru]</title>
- </head>
- <body>
- <div style="width:100%; height:auto; padding:0px 150px; background-color:#eee;">
- <div>
- <table>
- <tbody>
- <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>
- <tr style="min-height:60px;">Nama Pekerja : '.$pekerja.'</tr>
- </tbody>
- </table>
- <div>
- </div>
- </body>
- </html>';
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- $mail->send();
- // echo 'Message has been sent';
- } catch (Exception $e) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- }
- function saveData(){
- $pekerja = $this->input->post('name_emp');
- $data = array(
- 'nipg'=>$this->input->post('nipg'),
- 'title_prefix'=>$this->input->post('title_prefix'),
- 'title_sufix'=>$this->input->post('title_sufix'),
- 'name_emp'=>$this->input->post('name_emp'),
- 'grade_personal'=>$this->input->post('grade_personal'),
- 'no_ktp'=>$this->input->post('no_ktp'),
- 'npwp'=>$this->input->post('npwp'),
- 'birth_place'=>$this->input->post('birth_place'),
- 'birth_date'=>$this->input->post('birth_date'),
- 'religion_emp'=>$this->input->post('religion_emp'),
- 'address_emp'=>$this->input->post('address_emp'),
- 'gender'=>$this->input->post('gender'),
- 'email'=>$this->input->post('email'),
- //'status_emp'=>$this->input->post('status_emp'),
- 'status_assignment'=>$this->input->post('status_assignment'),
- 'status_active'=>$this->input->post('status_active'),
- 'status_nonactive'=>$this->input->post('status_nonactive'),
- 'date_status_nonactive'=>$this->input->post('date_status_nonactive'),
- 'date_position_emp'=>$this->input->post('date_position_emp'),
- 'date_startwork_emp'=>$this->input->post('date_startwork_emp'),
- 'recognize_education'=>$this->input->post('recognize_education'),
- 'last_education'=>$this->input->post('last_education'),
- 'year_of_graduate'=>$this->input->post('year_of_graduate'),
- 'name_univ_or_sch'=>$this->input->post('name_univ_or_sch'),
- 'concentration'=>$this->input->post('concentration'),
- 'dplk_bank'=>$this->input->post('dplk_bank'),
- 'dplk_bank_acc'=>$this->input->post('dplk_bank_acc'),
- 'bpjs_no_naker'=>$this->input->post('bpjs_no_naker'),
- 'date_of_personal_grade'=>$this->input->post('date_of_personal_grade'),
- 'date_of_personal_band'=>$this->input->post('date_of_personal_band'),
- 'bpjs_no_health'=>$this->input->post('bpjs_no_health'),
- 'payroll_bank'=>$this->input->post('payroll_bank'),
- 'payroll_bank_acc'=>$this->input->post('payroll_bank_acc'),
- 'no_hp'=>$this->input->post('no_hp'),
- 'ud_ditetapkan'=>$this->input->post('ud_ditetapkan'),
- 'id_position'=>$this->input->post('id_position'),
- 'instansi '=>$this->session->userdata('INSTANSI'),
- //tambahan revisi
- 'emergency_phone'=>$this->input->post('emergency_phone'),
- 'kerabat'=>$this->input->post('kerabat'),
- 'hubungan_kerabat'=>$this->input->post('hubungan_kerabat'),
- 'personal_job_family_01'=>$this->input->post('personal_job_family_01'),
- 'personal_job_family_02'=>$this->input->post('personal_job_family_02'),
- 'personal_sub_family_01'=>$this->input->post('personal_sub_family_01'),
- 'personal_sub_family_02'=>$this->input->post('personal_sub_family_02'),
- 'personal_sub_family_03'=>$this->input->post('personal_sub_family_03'),
- 'personal_sub_family_04'=>$this->input->post('personal_sub_family_04'),
- 'data_tunjangan'=>$this->input->post('data_tunjangan')
- );
- $this->db->insert('mst_employees', $data);
- $this->mailku($pekerja);
- redirect('employee');
- /*echo "<pre>";
- print_r($data);
- echo "/<pre>"; */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement