Advertisement
Guest User

phpmailerokki

a guest
Sep 19th, 2017
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3.  
  4. $mail = new PHPMailer;
  5.  
  6. $mail->SMTPDebug = 3;                               // Enable verbose debug output
  7.  
  8. $mail->isSMTP();                                      // Set mailer to use SMTP
  9. $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
  10. $mail->SMTPAuth = true;                               // Enable SMTP authentication
  11. $mail->Username = 'okkisetyawan@gmail.com';                 // SMTP username
  12. $mail->Password = '**********';                           // SMTP password
  13. $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
  14. $mail->Port = 465;                                    // TCP port to connect to
  15.  
  16. $mail->setFrom('okkisetyawan@gmail.com', 'Pengirim Okki');
  17. $mail->addAddress('okkisetyawan@gmail.com', 'Penerima Okki');     // Add a recipient
  18. // $mail->addAddress('ellen@example.com');               // Name is optional
  19. $mail->addReplyTo('okkisetyawan@gmail.com', 'Information Of Okki');
  20. // $mail->addCC('cc@example.com');
  21. // $mail->addBCC('bcc@example.com');
  22.  
  23. // $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
  24. // $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
  25. $mail->isHTML(true);                                  // Set email format to HTML
  26.  
  27. $mail->Subject = 'Here is the subject';
  28. $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
  29. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  30.  
  31. if(!$mail->send()) {
  32.     echo 'Message could not be sent.';
  33.     echo 'Mailer Error: ' . $mail->ErrorInfo;
  34. } else {
  35.     echo 'Message has been sent';
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement