Advertisement
Guest User

Untitled

a guest
Apr 13th, 2017
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. function smtpmailer($para, $de, $de_nome, $assunto, $corpo) {
  5.     require_once("dist/PHPMailer_5.2.4/class.phpmailer.php");
  6.  
  7.     if (!is_array($para)) {
  8.         $para = [$para];
  9.     }
  10.  
  11.     global $error;
  12.     $mail = new PHPMailer();
  13.     $mail->IsSMTP();        // Ativar SMTP
  14.     $mail->SMTPDebug = 2;       // Debugar: 1 = erros e mensagens, 2 = mensagens apenas
  15.     $mail->SMTPAuth = true;     // Autenticação ativada
  16.     $mail->SMTPSecure = 'ssl';  // SSL REQUERIDO pelo GMail
  17.     $mail->Host = 'cloud.hospedamb.com.br'; // SMTP utilizado
  18.     $mail->Port = 465;          // A porta 587 deverá estar aberta em seu servidor
  19.     $mail->Username = 'naoresponda@mixinternet.com.br';
  20.     $mail->Password = 'vMJco3y+foMS';
  21.     $mail->SetFrom($de, $de_nome);
  22.     $mail->Subject = $assunto;
  23.     $mail->Body = $corpo;
  24.  
  25.     foreach($para as $email) {
  26.         $mail->AddAddress($email);
  27.     }
  28.  
  29.     return $mail->Send();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement