Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. $mail = new PHPMailer(); // create a new object
  2. $mail->IsSMTP(); // enable SMTP
  3. $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  4. $mail->SMTPAuth = true; // authentication enabled
  5. $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
  6. $mail->Host = "smtp.gmail.com";
  7. $mail->Port = 465; // or 587
  8. $mail->IsHTML(true);
  9. $mail->Username = "email@gmail.com";
  10. $mail->Password = "password";
  11. $mail->SetFrom("example@gmail.com");
  12. $mail->Subject = "Test";
  13. $mail->Body = "hello";
  14. $mail->AddAddress("email@gmail.com");
  15.  
  16.  if(!$mail->Send()) {
  17.     echo "Mailer Error: " . $mail->ErrorInfo;
  18.  } else {
  19.     echo "Message has been sent";
  20.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement