Advertisement
Guest User

Untitled

a guest
May 13th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. public function mailku($pekerja) {
  2. $tgl = date("d-m-Y H-s");
  3. $user = $this->session->userdata('NAMA');
  4.  
  5. $mail = $this->phpmailerlib->load();
  6. $mail->SMTPDebug = 2; // Enable verbose debug output
  7. $mail->isSMTP(); // Set mailer to use SMTP
  8. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  9. $mail->SMTPAuth = true; // Enable SMTP authentication
  10. $mail->Username = 'gema.saputera9@gmail.com'; // SMTP username
  11. $mail->Password = 'evilrose09'; // SMTP password
  12. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  13. $mail->Port = 465; // TCP port to connect to
  14. //Recipients
  15. $mail->setFrom('gema.xavier@gmail.com', 'SOLID System | PGN');
  16.  
  17. $mail->addReplyTo('gema.saputera@gmail.com', 'Gema');
  18. //$mail->addCC('cc@example.com');
  19. //$mail->addBCC('bcc@example.com');
  20.  
  21. //Attachments
  22. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  23. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  24.  
  25. //Content
  26. $mail->isHTML(true); // Set email format to HTML
  27. $mail->Subject = '[SOLID System] Penambahan pekerja baru pada '.$tgl.'';
  28. $mail->Body = '<!DOCTYPE html>
  29. <head>
  30. <title>[Penambahan Pekerja Baru]</title>
  31. </head>
  32. <body>
  33. <div style="width:100%; height:auto; padding:0px 150px; background-color:#eee;">
  34. <div>
  35. <table>
  36. <tbody>
  37. <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>
  38. <tr style="min-height:60px;">Nama Pekerja : '.$pekerja.'</tr>
  39. </tbody>
  40. </table>
  41. <div>
  42. </div>
  43. </body>
  44. </html>';
  45. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  46. $mail->addAddress('gema.xavier@gmail.com', $user);
  47. if(!$mail->Send())
  48. {
  49. echo "Mailer Error: " . $mail->ErrorInfo;
  50. }
  51. else
  52. {
  53.  
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement