Advertisement
Guest User

Untitled

a guest
Feb 16th, 2017
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1.   public static function send($email,$subject,$message){
  2.         $mail = new PHPMailer();
  3.         $mail->isSMTP();
  4.         $mail->SMTPDebug = 2;
  5.        
  6.         $mail->Host = 'smtp.yandex.ru';
  7.         $mail->SMTPAuth = true;
  8.          $mail->ChartSet='UTF-8';
  9.         $mail->Username = 'mihail.donatelo@yandex.ua';                 // SMTP username
  10.         $mail->Password = 'mihail.donatelo228';                           // SMTP password
  11.         $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
  12.         $mail->Port = 465;
  13.  
  14.         $mail->setFrom('mihail.donatelo@yandex.ua','rwqrqwrwq');
  15.         if(is_array($email)&& !empty($email)){
  16.             foreach($email as $item){
  17.                 $mail->addAddress($item);
  18.             }
  19.         }else{
  20.             $mail->addAddress($email);
  21.         }
  22.         $mail->Subject = $subject;
  23.         $mail->Body    = $message;
  24.         if(!$mail->send()) {
  25.             echo 'Message could not be sent.';
  26.             echo 'Mailer Error: ' . $mail->ErrorInfo;
  27.         } else {
  28.             echo 'Message has been sent';
  29.         }
  30.  
  31.      exit;
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement