Guest User

Untitled

a guest
Mar 16th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. require 'PHPMailer.php';
  4.  
  5. define('GUSER', 'silencer.web@gmail.com');
  6. define('GPWD', '');
  7.  
  8. function smtpmailer($to, $from, $from_name, $subject, $body) {
  9. global $error;
  10.  
  11. $mail = new PHPMailer();
  12. $mail->IsSMTP();
  13. $mail->SMTPDebug = 0;
  14. $mail->SMTPAuth = true;
  15. $mail->SMTPSecure = 'ssl';
  16. $mail->Host = 'smtp.gmail.com';
  17. $mail->Port = 465;
  18. $mail->Username = GUSER;
  19. $mail->Password = GPWD;
  20. $mail->SetFrom($from, $from_name);
  21. $mail->Subject = $subject;
  22. $mail->Body = $body;
  23. $mail->AddAddress($to);
  24.  
  25. if(!$mail->Send()) {
  26. $error = 'Mail error: '.$mail->ErrorInfo;
  27. return false;
  28. } else {
  29. $error = 'Message sent!';
  30. return true;
  31. }
  32. }
  33.  
  34. smtpmailer('silencer.web@mail.ru', 'silencer.web@gmail.com', 'Maksim', 'Subject', 'Hello World!');
Add Comment
Please, Sign In to add comment