Guest User

Untitled

a guest
May 27th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3.  
  4.  
  5. class SendMail{
  6.  
  7. function mail($name, $to, $subject, $message) {
  8.  
  9. $mail = new PHPMailer;
  10. $mail->SMTPDebug = 3; // Enable verbose debug output
  11.  
  12. $mail->isSMTP(); // Set mailer to use SMTP
  13. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  14. $mail->SMTPAuth = true; // Enable SMTP authentication
  15. $mail->Username = 'care.prakashoffset@gmail.com'; // SMTP username
  16. $mail->Password = 'care@prakash'; // SMTP password
  17. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  18. $mail->Port = 465; // TCP port to connect to
  19.  
  20. $mail->From = 'info@prakashoffset.com';
  21. $mail->FromName = 'Prakash Offset';
  22. $mail->addAddress($to); // Add a recipient
  23. $mail->addReplyTo('info@prakashoffset.com', 'reply');
  24. // $mail->addCC('cc@example.com');
  25. // $mail->addBCC('bcc@example.com');
  26. $mail->isHTML(true); // Set email format to HTML
  27.  
  28. $mail->Subject = $subject;
  29. $mail->Body = $message;
  30. /*$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';*/
  31.  
  32. if(!$mail->send()) {
  33. return false;
  34. } else {
  35. return true;
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment