Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2.     ini_set('display_errors', '1');
  3.     require_once 'phpmailer/PHPMailerAutoload.php';
  4.     $mail = new PHPMailer();
  5.         try {
  6.             //Server settings
  7.             $mail->isSMTP(true);                                      // Set mailer to use SMTP
  8.                 $mail->SMTPAuth = true;
  9.                 $mail->SMPTSecure = 'tls';
  10.                 $mail->Host ='smtp.gmail.com';
  11.                 $mail->Port='587';
  12.  
  13.             $mail->Username = 'mrl0c4d@gmail.com';                 // SMTP username
  14.             $mail->Password = 'KodokLoncat123';                           // SMTP password
  15.  
  16.             //Recipients
  17.             $mail->setFrom('', 'Perpustakaan SMK Telekomunikasi Telesandi Bekasi');
  18.             $mail->addAddress('gooneps@gmail.com', 'bhh');     // Add a recipient
  19.             $mail->addReplyTo('gooneps@gmail.com', 'Information');
  20.  
  21.             //Attachments
  22.  
  23.             //Content
  24.             $mail->isHTML(true);                                  // Set email format to HTML
  25.             $mail->Subject = 'helo';
  26.             $mail->Body    = 'world';
  27.             $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  28.  
  29.             $mail->send();
  30.             echo 'Message has been sent';
  31.         } catch (Exception $e) {
  32.             echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  33.         }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement