Advertisement
Guest User

Untitled

a guest
Oct 4th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. function mailTo ( $emails, $subject, $message ) {
  2.  
  3. $mail = new PHPMailer;
  4. $mail->isSMTP();
  5. $mail->isHTML(true);
  6. $mail->setFrom( SITE_EMAIL, SITE_NAME );
  7. $mail->Host = 'smtp.gmail.com';
  8. $mail->SMTPAuth = true;
  9. $mail->Username = SMTP_LOGIN;
  10. $mail->Password = SMTP_PASS;
  11. $mail->SMTPSecure = 'ssl';
  12. $mail->Port = 465;
  13.  
  14. if ( !is_array($emails) ) $emails = [ $emails ];
  15. foreach ( $emails as $key ) $mail->addAddress( $key );
  16.  
  17. $mail->Subject = $subject;
  18. $mail->Body = $message;
  19.  
  20. return ( $mail->send() ) ? true : false;
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement