Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2. public function mailer() {
  3. require_once "vendor/autoload.php";
  4. $mail = new PHPMailer;
  5. $mail->SMTPDebug = 3; // Enable verbose debug output
  6. $mail->isSMTP(); // Set mailer to use SMTP
  7. $mail->Host = 'ssl://smtp.gmail.com'; // Specify main and backup SMTP servers
  8. $mail->SMTPAuth = true; // Enable SMTP authentication
  9. $mail->Username = 'monii5686@gmail.com'; // SMTP username
  10. $mail->Password = 'kindle@123'; // SMTP password
  11. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  12. $mail->Port = 465; // TCP port to connect to
  13. $mail->setFrom('monii5686@gmail.com', 'Mailer');
  14. $mail->addAddress('test@yopmail.com', 'Joe User'); // Add a recipient
  15. // $mail->addReplyTo('rafaela.dooley@smith.com', 'Information');
  16.  
  17. $mail->isHTML(true); // Set email format to HTML
  18.  
  19. $mail->Subject = 'Here is the subject';
  20. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  21. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  22. if(!$mail->send()) {
  23. echo 'Message could not be sent.';
  24. echo 'Mailer Error: ' . $mail->ErrorInfo;
  25. } else {
  26. echo 'Message has been sent';
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement