Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $mail = new PHPMailer;
  2. $mail->SMTPDebug = 2; // Enable verbose debug output
  3. $mail->isSMTP(); // Set mailer to use SMTP
  4. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  5. $mail->SMTPAuth = true; // Enable SMTP authentication
  6. $mail->Username = 'example@gmail.com'; // SMTP username
  7. $mail->Password = 'mypassword'; // SMTP password
  8. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  9. $mail->Port = 587;
  10. $mail->setFrom('example@gmail.com', 'Your Name');
  11. $mail->addAddress('example@gmail.com', 'My Friend');
  12. $mail->Subject = 'First PHPMailer Message';
  13. $mail->Body = 'Hi! This is my first e-mail sent through PHPMailer.';
  14. if(!$mail->send()) {
  15. echo 'Message was not sent.';
  16. echo 'Mailer error: ' . $mail->ErrorInfo;
  17. } else {
  18. echo 'Message has been sent.';
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement