Guest User

Untitled

a guest
Jul 16th, 2017
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3.  
  4. $mail = new PHPMailer();
  5. $mail->SMTPDebug = 2; // Enable verbose debug output
  6. $mail->Debugoutput = 'html';
  7. $mail->isSMTP();
  8. // Set mailer to use SMTP
  9. //$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  10. $mail->SMTPAuth = true;
  11. $mail->Host = 'smtp.gmail.com'; // Enable SMTP authentication
  12. $mail->Username = 'mohitgtbit@gmail.com'; // SMTP username
  13. $mail->Password = '***************'; // SMTP password
  14. $mail->SMTPSecure = 'TLS'; // Enable TLS encryption, `ssl` also accepted
  15. $mail->Port = 587; // TCP port to connect to
  16.  
  17. $mail->setFrom('mohitgtbit@gmail.com', 'Mailer');
  18. $mail->addAddress('smartymohit9@gmail.com'); // Add a recipient
  19.  
  20. // Optional name
  21. $mail->isHTML(true); // Set email format to HTML
  22.  
  23. $mail->Subject = 'Here is the subject';
  24. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  25. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  26.  
  27. if(!$mail->send()) {
  28. echo 'Message could not be sent.';
  29. echo 'Mailer Error: ' . $mail->ErrorInfo;
  30. } else {
  31. echo 'Message has been sent';
  32. }
Add Comment
Please, Sign In to add comment