Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2. require_once('phpmailer/class.phpmailer.php');
  3. $mail = new PHPMailer;
  4. $mail->SMTPDebug = 1; // Enable verbose debug output
  5. $mail->isSMTP(); // Set mailer to use SMTP
  6. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  7. $mail->SMTPAuth = true; // Enable SMTP authentication
  8. $mail->Username = 'test@test'; // SMTP username
  9. $mail->Password = 'test'; // SMTP password
  10. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  11. $mail->Port = 465; // TCP port to connect to
  12. $mail->setFrom('test@thecopyrat.com', 'Subject');
  13. $mail->addAddress('maulik153m@gmail.com');
  14. $mail->isHTML(true); // Set email format to HTML
  15. $mail->Subject = 'Test';
  16. $mail->Body = 'Demo';
  17.  
  18. if(!$mail->send()) {
  19. return 'Message could not be sent.';
  20. return 'Mailer Error: ' . $mail->ErrorInfo;
  21. } else {
  22. return 'Message has been sent';
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement