コード例 #1
0
ファイル: email.gti.php プロジェクト: silloty/vox
 function Enviar($de, $para, $assunto, $nome_remetente)
 {
     require_once '../config.cls.php';
     $config = new clsConfig();
     /*
     		$msg = implode("n", $this->parts);
             
     		if(!mail($para, $assunto, $msg, "From: $nome_remetente\nContent-Type: text/html; charset=iso-8859-1"))
     		{
     			return false;
     		}
     		else
     		{
     			return true;
     		}
     */
     //if(($para=="") || ($para==0))
     //{
     //	$para="*****@*****.**";
     //}
     $msg = implode("n", $this->parts);
     $email = new PHPMailer();
     $email->IsSMTP();
     $email->Host = $config->GetEmailHost();
     $email->SMTPAuth = true;
     $email->Username = $config->GetEmailOuvidoria();
     $email->Password = $config->GetEmailSenha();
     $email->From = $de;
     $email->CharSet = "UTF-8";
     $email->SMTPSecure = "tls";
     $email->FromName = $nome_remetente;
     $email->Subject = $assunto;
     $email->IsHtml(true);
     $email->AddAddress($para, $para);
     $email->Body = $msg;
     $email->SMTP_PORT = 587;
     $email->AltBody = $msg;
     if (!$email->Send()) {
         return false;
     } else {
         return true;
     }
     //echo print_r($email->ErrorInfo);
 }