SHARE
TWEET

Untitled

a guest Oct 4th, 2017 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top