Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. $mail = new PHPMailer;
  2.  
  3. $mail->isSMTP(); // Set mailer to use SMTP
  4. $mail->SMTPAuth = true; // Enable SMTP authentication
  5. $mail->Username = 'xx@gmail.com'; // SMTP username
  6. $mail->Password = 'xxxx'; // SMTP password
  7. $mail->Host = 'smtp.gmail.com';
  8. $mail->SMTPSecure = 'ssl';
  9. $mail->Port = 465;
  10.  
  11. //Set the encryption system to use - ssl (deprecated) or tls
  12. $mail->setFrom('info@example.com', 'CodexWorld');
  13. $mail->addReplyTo('info@example.com', 'CodexWorld');
  14. $mail->addAddress('john@gmail.com'); // Add a recipient
  15. $mail->addAddress($data['email']); // Add a recipient
  16. $mail->isHTML(true); // Set email format to HTML
  17.  
  18. $message = '
  19.  
  20. <p>HELLO</p>
  21.  
  22. ';
  23.  
  24. $mail->msgHTML($message);
  25.  
  26. try {
  27. if(!$mail->send())
  28. {
  29. echo $mail->ErrorInfo;
  30. } else {
  31. /*redirect*/
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement