当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPMailer::getFile方法代码示例

本文整理汇总了PHP中PHPMailer::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::getFile方法的具体用法?PHP PHPMailer::getFile怎么用?PHP PHPMailer::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


在下文中一共展示了PHPMailer::getFile方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: kdmail

 function kdmail($f)
 {
     $this->load('lib/phpmailer/class.phpmailer');
     $mail = new PHPMailer();
     //$body             = $mail->getFile(ROOT.'index.php');
     //$body             = eregi_replace("[\]",'',$body);
     $mail->IsSendmail();
     // telling the class to use SendMail transport
     $mail->From = $f["from"];
     $mail->FromName = either($f["fromname"], "noticer");
     $mail->Subject = either($f["subject"], "hello");
     //$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
     $mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
     // optional, comment out and test
     if ($f["embedimg"]) {
         foreach ($f["embedimg"] as $i) {
             //$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
             $mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
         }
     }
     if ($f["msgfile"]) {
         $body = $mail->getFile($f["msgfile"]);
         $body = eregi_replace("[\\]", '', $body);
         if ($f["type"] == "text") {
             $mail->IsHTML(false);
             $mail->Body = $body;
         } else {
             $mail->MsgHTML($body);
             //."<br><img src= \"cid:logo\">");
         }
     } else {
         if ($f["type"] == "text") {
             $mail->IsHTML(false);
             $mail->Body = $f["msg"];
         } else {
             $mail->MsgHTML($f["msg"]);
             //."<br><img src= \"cid:logo\">");
         }
     }
     if (preg_match('/\\,/', $f["to"])) {
         $emails = explode(",", $f["to"]);
         foreach ($emails as $i) {
             $mail->AddAddress($i, $f["toname"]);
         }
     } else {
         $mail->AddAddress($f["to"], $f["toname"]);
     }
     $mail->AddBCC($this->config["site"]["mail"], "bcc");
     if ($f["files"]) {
         foreach ($f["files"] as $i) {
             $mail->AddAttachment($i);
             // attachment
         }
     }
     if (!$mail->Send()) {
         return "Mailer Error: " . $mail->ErrorInfo;
     } else {
         return "Message sent!";
     }
 }
开发者ID:tranngocthang89,项目名称:basephpmvc,代码行数:60,代码来源:application.php

示例2: PHPMailer

<?php

include "class.phpmailer.php";
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = $mail->getFile('contents.html');
$body = eregi_replace("[\\]", '', $body);
$mail->IsSMTP();
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = "ssl";
// sets the prefix to the servier
$mail->Host = "smtp.gmail.com";
// sets GMAIL as the SMTP server
$mail->Port = 465;
// set the SMTP port for the GMAIL server
$mail->Username = "yourusername@gmail.com";
// GMAIL username
$mail->Password = "yourpassword";
// GMAIL password
$mail->AddReplyTo("yourusername@gmail.com", "First Last");
$mail->From = "name@yourdomain.com";
$mail->FromName = "First Last";
$mail->Subject = "PHPMailer Test Subject via gmail";
//$mail->Body       = "Hi,<br>This is the HTML BODY<br>";                      //HTML Body
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->WordWrap = 50;
// set word wrap
$mail->MsgHTML($body);
$mail->AddAddress("whoto@otherdomain.com", "John Doe");
开发者ID:l2zeo,项目名称:miwit-pack5,代码行数:31,代码来源:test_gmail.php

示例3: PHPMailer

<?php

error_reporting(E_ALL);
//error_reporting(E_STRICT);
//date_default_timezone_set('America/Toronto');
date_default_timezone_set(date_default_timezone_get());
include_once '../tools/phpMailer/class.phpmailer.php';
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
//$mail->SetLanguage("en", "../tools/phpMailer/language/");
$mail = new PHPMailer();
$body = $mail->getFile('../slave/slave.xml');
//$body             = iconv('gb2312', 'utf-8',$body);
//$body             = eregi_replace("[\]",'',$body);
$mail->IsSMTP();
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = "ssl";
// sets the prefix to the servier
$mail->Host = "smtp.gmail.com";
// sets GMAIL as the SMTP server
$mail->Port = 465;
// set the SMTP port for the GMAIL server
// 测试帐户,别捣乱啊!
$mail->Username = "anehtatest@gmail.com";
// GMAIL username
$mail->Password = "anehta111111";
// GMAIL password
//$mail->AddReplyTo("yourusername@gmail.com","First Last");
$mail->From = "anehtatest@gmail.com";
$mail->FromName = "Anehta";
// 获取水印
开发者ID:moorefu,项目名称:anehta,代码行数:31,代码来源:mail.php

示例4: PHPMailer

//Script by Code52.net
//代码吾爱,Be a happy coder.
//需要传进来的参数:
/*
 * randmailFrom
 * mailTo
 * randsubject
 * randContent
 */
include "class.phpmailer.php";
include "class.smtp.php";
// 可选
$mail = new PHPMailer();
$randContent = rand(1, 3);
$content = "test/" . $randContent . ".html";
$body = $mail->getFile("{$content}");
//邮件正文内容,提取html文件为其内容
$body = eregi_replace("[\\]", '', $body);
$mail->IsSMTP();
$mail->SMTPAuth = true;
// 必填,SMTP服务器是否需要验证,true为需要,false为不需要
$mail->Host = "mail.bnu.edu.cn";
//必填,设置SMTP服务器
//$mail->Port       = 25;                   // 设置端口
$mail->Username = "heyue@mail.bnu.edu.cn";
// 必填,开通SMTP服务的邮箱;任意一个foxmail邮箱均可
$mail->Password = "bnuheyue";
//必填, 以上邮箱对应的密码
$mail->From = "heyue@mail.bnu.edu.cn";
//必填,发件人Email
$mail->FromName = "heyue";
开发者ID:dalinhuang,项目名称:c2my,代码行数:31,代码来源:foxmail.php

示例5: enviaEmailProvaAlunoDAO

	public function enviaEmailProvaAlunoDAO($filtro = ''){

		$banco			= $this->getBancoDados(); 
		$sessionFacade	= new SessionFacade($banco); 

		/* INSERI REGISTRO PARA AS PROVAS QUE AINDA NAO TEM */
		$query = " INSERT INTO tbl_prova_aluno_email (prova,aluno)
					SELECT tbl_prova_aluno.prova, tbl_prova_aluno.aluno
					FROM tbl_prova
					JOIN tbl_disciplina  USING(disciplina)
					JOIN tbl_prova_aluno ON tbl_prova_aluno.prova = tbl_prova.prova
					WHERE (tbl_prova_aluno.prova,tbl_prova_aluno.aluno) NOT IN (
						SELECT tbl_prova_aluno.prova,tbl_prova_aluno.aluno
						FROM tbl_prova_aluno
						JOIN tbl_prova_aluno_email ON tbl_prova_aluno_email.aluno = tbl_prova_aluno.aluno AND tbl_prova_aluno_email.prova = tbl_prova_aluno.prova
					);";
		if(!$banco->updateSQL($query)) {
			throw new Exception("Erro inserir registro de email da prova ($query) ".$banco->mysql_error()); 
		}

		$filtro_sql   = " AND   DATEDIFF(tbl_prova.data_inicio,CURRENT_DATE) BETWEEN 0 and 4 ";
		$filtro_sql_2 = "";

		if ($filtro == 'corrigida'){
			$filtro_sql = " AND tbl_prova.prova IN (
									SELECT tbl_prova_aluno.prova
									FROM  tbl_prova_aluno_pergunta
									JOIN  tbl_prova_aluno  ON tbl_prova_aluno.prova = tbl_prova_aluno_pergunta.prova AND tbl_prova_aluno.aluno = tbl_prova_aluno_pergunta.aluno
									WHERE tbl_prova_aluno_pergunta.prova = tbl_prova.prova
									AND   tbl_prova_aluno_pergunta.valor_corrigido IS NULL
									AND   DATEDIFF(tbl_prova_aluno.nota_liberada,CURRENT_DATE) BETWEEN 0 and 1
							) > 0";
			$filtro_sql_2 = $filtro_sql;
		}

		$query ="SELECT tbl_prova.prova                  AS prova,
						tbl_prova.titulo                 AS titulo,
						tbl_disciplina.nome              AS disciplina,
						tbl_professor.nome               AS professor,
						DATE_FORMAT(tbl_prova.data , '%d/%m/%Y %H:%i') AS data,
						DATE_FORMAT(tbl_prova.data_inicio , '%d/%m/%Y %H:%i') AS data_inicio,
						DATE_FORMAT(tbl_prova.data_termino , '%d/%m/%Y %H:%i') AS data_termino,
						DATE_FORMAT(tbl_prova.liberada , '%d/%m/%Y %H:%i') AS liberada
				FROM tbl_prova
				JOIN tbl_disciplina USING(disciplina)
				LEFT JOIN tbl_professor  ON tbl_professor.professor = tbl_prova.professor
				WHERE tbl_disciplina.instituicao = $this->_login_instituicao
				$filtro_sql
				";
		$retorno = $banco->executaSQL($query);
		if($retorno != NULL) {
			while($linha = $banco->fetchArray($retorno)) {
				$prova         = $linha['prova'];
				$titulo        = $linha['titulo'];
				$disciplina    = $linha['disciplina'];
				$professor     = $linha['professor'];
				$data          = $linha['data'];
				$data_inicio   = $linha['data_inicio'];
				$data_termino  = $linha['data_termino'];
				$liberada      = $linha['liberada'];

				$sql = "SELECT tbl_prova_aluno.aluno AS aluno,
								tbl_aluno.nome,
								tbl_aluno.email,
								tbl_aluno.email AS login,
								tbl_aluno.senha
						FROM tbl_prova 
						JOIN tbl_prova_aluno            USING (prova)
						JOIN tbl_aluno                  ON tbl_aluno.aluno       = tbl_prova_aluno.aluno
						LEFT JOIN tbl_prova_aluno_email ON tbl_prova_aluno.prova = tbl_prova_aluno_email.prova AND tbl_prova_aluno.aluno = tbl_prova_aluno_email.aluno
						WHERE tbl_prova.prova = ".$prova."
						AND   tbl_prova_aluno_email.agendada IS NOT TRUE 
						$filtro_sql_2
						"; 
				$retorno_aluno = $banco->executaSQL($sql);
				if($retorno_aluno != NULL) {
					while($linha = $banco->fetchArray($retorno_aluno)) {

						if (getRealIpAddr() != '127.0.0.1'){
							$mail             = new PHPMailer();
							$body             = $mail->getFile('../emails/prova_aluno.html');

							$variaveis = array("{ALUNO}","{PROFESSOR}","{PROVA_TITULO}",'{PROVA_INICIO}','{PROVA_TERMINO}', "{LOGIN}", "{SENHA}","{KEY}","{P}","{A}");
							$valores   = array(	$linha['nome'], 
												$disciplina,
												$titulo,
												$data_inicio,
												$data_termino,
												$linha['login'], 
												$linha['senha'],
												md5($linha['aluno'].$linha['login']),
												'',
												$linha['aluno']
												);
							$body      = str_replace($variaveis, $valores, $body);

							$mail->From       = "testenetweb@gmail.com";
							$mail->FromName   = "TesteNet";
							$mail->Subject    = "TesteNet - Nova Prova!";
							$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
//.........这里部分代码省略.........
开发者ID:nowakis,项目名称:TesteNet,代码行数:101,代码来源:class.prova.DAO.php

示例6: die

            $result = mysql_query($SQL) or die("MySQL-err.Query: " . $SQL . " - Error: (" . mysql_errno() . ") " . mysql_error());
            $num_rows = mysql_num_rows($result);
            if ($num_rows == 0) {
                $SQL = "INSERT INTO EMAIL_INV_APP1 (groupowner_id,groupmember_id,followed, completed, creation_date) VALUES({$groupownerid},{$user_app1id},0,0,NOW())";
                $result = mysql_query($SQL, $connection) or die("MySQL-err.Query: " . $SQL . " - Error: (" . mysql_errno() . ") " . mysql_error());
            }
            $mail = new PHPMailer();
            // defaults to using php "mail()"
            $mail->From = EMAIL_FROM_APP1;
            $mail->FromName = EMAIL_FROM_NAME_APP1;
            $mail->FromName = str_replace('{SENDER_NAME}', $groupownerrow["fbname"], $mail->FromName);
            //Headers
            $mail->Subject = APP1_SUMATE_SUBJECT;
            $mail->Subject = str_replace('{SENDER_NAME}', $groupownerrow["fbname"], $mail->Subject);
            $mail->AltBody = BODY_ALT;
            $body = $mail->getFile('../invitacion_app1.html');
            $body = str_replace('{SERVER_NAME}', SERVER_NAME, $body);
            $body = str_replace('{SENDER_NAME}', $groupownerrow["fbname"], $body);
            $link = 'https://www.facebook.com/' . PAGE_NAME . '?sk=app_' . APPLICATION1_ID;
            $link = $link . '&app_data=join_group|' . $groupownerid . '|' . $user_app1id . '|';
            $body = str_replace('{PAGE_LINK}', $link, $body);
            $body = eregi_replace("[\\]", '', $body);
            $mail->MsgHTML("{$body}");
            $mail->AddAddress($email_address, $email_address);
            $mail_sent = $mail->Send();
        }
    }
}
closeConnection($connection);
?>
<html>
开发者ID:rraaff,项目名称:tdil-fb-app,代码行数:31,代码来源:inviteemail.php

示例7: gravaDadosAluno

	public function gravaDadosAluno(Aluno $aluno){

		$banco = $this->getBancoDados(); 

		$query = " SELECT count(*) AS cont
					FROM tbl_aluno
					WHERE 1=1 /*instituicao = $aluno->_login_instituicao */
					AND   email       = $aluno->Xemail 
					AND   senha       = $aluno->Xsenha ";
		if (strlen($aluno->getId())>0){
			$query .= " AND   aluno      <> ".$aluno->getId();
		}

		$retorno = $banco->executaSQL($query); 

		if ($banco->numRows($retorno) == 0){
			throw new Exception("Erro inesperado ao salvar informações do aluno. Tente novamente. Se o erro persistir, entre em contato com o seu supervisor.",0);
		}

		$linha = $banco->fetchArray($retorno); 
		if ($linha['cont']>0){
			throw new Exception("Já existe outro aluno com este Email. Não é possível duplicidade. Operação não foi concluída",0);
		}

		if (strlen($aluno->getId())>0){
			$query = " UPDATE tbl_aluno SET
							nome        = $aluno->Xnome,
							ra          = $aluno->Xra,
							email       = $aluno->Xemail,
							senha       = $aluno->Xsenha,
							ativo       = $aluno->Xativo,
							endereco    = $aluno->Xendereco,
							numero      = $aluno->Xnumero,
							complemento = $aluno->Xcomplemento,
							bairro      = $aluno->Xbairro,
							cidade      = $aluno->Xcidade,
							estado      = $aluno->Xestado,
							cep         = $aluno->Xcep,
							pais        = $aluno->Xpais
						WHERE aluno    = ".$aluno->getId()."
						AND   instituicao = $aluno->_login_instituicao ";
		}else{
			$query = "INSERT INTO tbl_aluno (
							instituicao,
							nome,
							ra,
							email,
							senha,
							ativo,
							endereco,
							numero,
							complemento,
							bairro,
							cidade,
							estado,
							cep,
							pais
					) VALUES (
							$aluno->_login_instituicao,
							$aluno->Xnome,
							$aluno->Xra,
							$aluno->Xemail,
							$aluno->Xsenha,
							$aluno->Xativo,
							$aluno->Xendereco,
							$aluno->Xnumero,
							$aluno->Xcomplemento,
							$aluno->Xbairro,
							$aluno->Xcidade,
							$aluno->Xestado,
							$aluno->Xcep,
							$aluno->Xpais
						)";
		}

		if(!$banco->updateSQL($query)) {
			throw new Exception("Erro ao atualizar / inserir ALUNO. ($query) "); 
		}
		if (strlen($aluno->getId())==0){
			$aluno->setId($banco->insert_id());

			/* Envio de E-Mail para Avisar Aluno */
			$mail             = new PHPMailer();
			$body             = $mail->getFile('emails/cadastro_aluno.html');

			global $_login_instituicao_nome;

			$variaveis = array("{ALUNO}","{LOGIN}", "{SENHA}", "{NOME_INSTITUICAO}");
			$valores   = array(	$aluno->getNome(), 
								$aluno->getEmail(),
								$aluno->getSenha(),
								$_login_instituicao_nome
							);
			$body      = str_replace($variaveis, $valores, $body);

			$mail->From       = "testenetweb@gmail.com";
			$mail->FromName   = "TesteNet";
			$mail->Subject    = "TesteNet - Seja Bem Vindo!";
			$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
			$mail->MsgHTML($body);
//.........这里部分代码省略.........
开发者ID:nowakis,项目名称:TesteNet,代码行数:101,代码来源:class.aluno.DAO.php

示例8: PHPMailer

<?php 
// 使用PHPMailer发送邮件实例,163邮箱
//Script by Code52.net
//代码吾爱,Be a happy coder.
include "class.phpmailer.php";
include "class.smtp.php";
// 可选
$mail = new PHPMailer();
$body = $mail->getFile('test/contents.html');
//邮件正文内容,提取html文件为其内容
$body = eregi_replace("[\\]", '', $body);
$mail->IsSMTP();
$mail->SMTPAuth = true;
// 必填,SMTP服务器是否需要验证,true为需要,false为不需要
$mail->Host = "smtp.163.com";
//必填,设置SMTP服务器
//$mail->Port       = 25;                   // 设置端口
$mail->Username = "watternategates@163.com";
// 必填,开通SMTP服务的邮箱;任意一个163邮箱均可
$mail->Password = "qwertyuiop";
//必填, 以上邮箱对应的密码
$mail->From = "watternategates@163.com";
//必填,发件人Email
$mail->FromName = "河马";
//必填,发件人昵称或姓名
$mail->Subject = "This is the subject";
//必填,邮件标题(主题)
$mail->AltBody = "This is the body when user views in plain text format";
//可选,纯文本形势下用户看到的内容
$mail->WordWrap = 50;
// 自动换行的字数
开发者ID:GHubgenius,项目名称:julianufo-project-daigou,代码行数:31,代码来源:163.php

示例9: gravaProvaCorrigirDAO

	public function gravaProvaCorrigirDAO(ProvaRespondida $prova_respondida){

		$banco = $this->getBancoDados();

		$query = "SELECT tbl_prova_aluno.prova
					FROM tbl_prova_aluno 
					WHERE prova = ".$prova_respondida->getProva()->getId()."
					AND   aluno = ".$prova_respondida->getAluno()->getId();
		$retorno = $banco->executaSQL($query); 
		if ($banco->numRows($retorno) == 0){
			throw new Exception("Erro ao atualizar nota da prova (SQL: $query) "); 
		}

		$query = " UPDATE tbl_prova_aluno SET
							nota          = ".$prova_respondida->Xnota.",
							nota_liberada = ".$prova_respondida->Xnota_liberada."
					WHERE prova = ".$prova_respondida->getProva()->getId()."
					AND   aluno = ".$prova_respondida->getAluno()->getId();
		#echo nl2br($query);
		if(!$banco->updateSQL($query)) {
			throw new Exception("Erro ao atualizar nota PROVA RESPONDIDA. (SQL: $query) "); 
		}

		if (strlen($prova_respondida->getNotaLiberada())>0){
			if (getRealIpAddr() != '127.0.0.1' or 1==1){

				$prova = $prova_respondida->getProva();
				$mail             = new PHPMailer();

				$body             = $mail->getFile('emails/prova_corrigida_aluno.html');

				$variaveis = array("{ALUNO}","{PROFESSOR}","{NOME_INSTITUICAO}","{PROVA_TITULO}",'{PROVA_INICIO}','{PROVA_TERMINO}','{PROVA_NOTA}', "{LOGIN}", "{SENHA}");
				$valores   = array(	$nome_aluno, 
									$prova->getProfessor()->getNome(),
									$prova->getDisciplina()->getInstituicao()->getNome(),
									$prova->getTitulo(),
									$prova->getDataInicio(),
									$prova->getDataTermino(),
									$prova_respondida->getNota(),
									$ra_aluno, 
									$senha_aluno);
				$body      = str_replace($variaveis, $valores, $body);
				$mail->From       = "testenetweb@gmail.com";
				$mail->FromName   = "TesteNet";
				$mail->Subject    = "TesteNet - Nova Prova!";
				$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
				$mail->MsgHTML($body);
				$mail->AddAddress($email_aluno, $nome_aluno);
				$mail->AddAddress('testenetweb@gmail.com', 'Suporte TesteNet');
				$mail->Send();
			}
		}
	}
开发者ID:nowakis,项目名称:TesteNet,代码行数:53,代码来源:class.prova_respondida.DAO.php

示例10: PHPMailer

     $apellido = $result_user['apellido'];
     $usuario = $result_user['usuario'];
     $password = $result_user['password'];
     $emailto = $result_user['email'];
     $mail = new PHPMailer();
     // defaults to using php "mail()"
     //$mail->Mailer = 'smtp';
     $mail->SMTPDebug = true;
     $mail->From = EMAIL_FROM;
     $mail->FromName = EMAIL_FROM_NAME;
     //Headers
     $headers['X-Mailer'] = 'X-Mailer: PHP/' . phpversion();
     $mail->AddCustomHeader($headers);
     $mail->Subject = PASSWORD_REMINDER_SUBJECT;
     $mail->AltBody = PASSWORD_REMINDER_BODY_ALT;
     $body = $mail->getFile('password_reminder.html');
     $body = str_replace('{NOMBRE}', $nombre, $body);
     $body = str_replace('{APELLIDO}', $apellido, $body);
     $body = str_replace('{USUARIO}', $usuario, $body);
     $body = str_replace('{PASSWORD}', $password, $body);
     $body = str_replace('{SERVER_NAME}', SERVER_NAME, $body);
     $mail->MsgHTML("{$body}");
     $mail->AddAddress("{$emailto}", "{$nombre} {$apellido}");
     if (!$mail->Send()) {
         $err_mail = $mail->ErrorInfo;
         $output = '{ "success": "no", "error": "Error enviando el email." }';
     } else {
         $output = '{ "success": "yes", "error": "" }';
     }
 } else {
     // Si ya fue cargado, doy mensaje de error
开发者ID:rraaff,项目名称:las-moras,代码行数:31,代码来源:doRecordarPassword.php

示例11: divulgacaoPesquisaDAO

	public function divulgacaoPesquisaDAO($divulgacao){

		$banco = $this->getBancoDados(); 

		$query = "	SELECT tbl_divulgacao.divulgacao, tbl_divulgacao.professor, tbl_divulgacao.aluno, tbl_divulgacao.nome, tbl_divulgacao.email, tbl_professor.senha, tbl_professor.email AS email2
					FROM tbl_divulgacao
					LEFT JOIN tbl_professor USING(professor)
					WHERE tbl_divulgacao.acesso IS NOT NULL
					ORDER BY tbl_divulgacao.ultimo_email ASC 
					LIMIT ".$divulgacao->getQtdeEmail();
		$disciplina = NULL; 
		$retorno = $banco->executaSQL($query); 
		if($retorno != NULL) {

			$sessionFacade = new SessionFacade($banco); 

			while($linha = $banco->fetchArray($retorno)) { 

				$rand = new UniqueRand();

				$email = $linha['email'];

				if (strlen($linha['email2'])>0){
					$email = $linha['email2'];
				}

				if (getRealIpAddr() != '127.0.0.1'){
					/* Envio de E-Mail para Avisar Divulgacao */
					$mail             = new PHPMailer();
					$body             = $mail->getFile('../emails/divulgacao_pesquisa.html');

					$variaveis = array("{NOME}","{EMAIL}","{KEY}","{P}","{A}");
					$valores   = array( $linha["nome"], $email ,md5($linha['professor'].$email),$linha['professor'],'');
					$body      = str_replace($variaveis, $valores, $body);

					$mail->From       = "testenetweb@gmail.com";
					$mail->FromName   = "Fábio Nowaki";
					$mail->Subject    = "Sistema de Provas OnLine GRATUÍTO!";
					$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
					$mail->MsgHTML($body);
					$mail->AddAddress($linha["email"], $linha["nome"]);
					#$mail->AddAddress('testenetweb@gmail.com', 'TesteNet Web');
					$mail->Send();
				}
			}

		} else {
			throw new Exception("Erro ao recuperar Disvulgacao de Pesquisa ($query)"); 
		}
	}
开发者ID:nowakis,项目名称:TesteNet,代码行数:50,代码来源:class.divulgacao.DAO.php

示例12: Professor

		global $_login_instituicao;
		$_login_instituicao = $instit->getId();

		$prof = new Professor();
		$prof->setNome($professor_nome);
		$prof->setNivelEnsino($nivel_ensino);
		$prof->setAreaAtuacao($area_atuacao);
		$prof->setEmail($email);
		$prof->setLogin($login);
		$prof->setSenha($senha);
		$prof->setAtivo('1');
		$sessionFacade->gravarProfessor($prof);

		$mail             = new PHPMailer();

		$body             = $mail->getFile('www/emails/cadastro_professor.html');

		$variaveis = array("{PROFESSOR}", "{LOGIN}", "{SENHA}");
		$valores   = array($professor_nome,$login, $senha);
		$body      = str_replace($variaveis, $valores, $body);

		$mail->From       = "testenetweb@gmail.com";
		$mail->FromName   = "TesteNet";
		$mail->Subject    = "TesteNet - Seja Bem Vindo!";
		$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
		$mail->MsgHTML($body);
		$mail->AddAddress($email, $professor_nome);
		$mail->AddBCC('testenetweb@gmail.com', 'Suporte TesteNet');
		$mail->Send();

		$banco->efetivarTransacao();
开发者ID:nowakis,项目名称:TesteNet,代码行数:31,代码来源:cadastro.php

示例13: gravaDadosComunicado

	public function gravaDadosComunicado(Comunicado $comunicado){

		$banco = $this->getBancoDados(); 

		if (strlen($comunicado->getId())>0){
			$query = " UPDATE tbl_comunicado SET
								instituicao     = $comunicado->Xinstituicao,
								curso           = $comunicado->Xcurso,
								professor       = $comunicado->Xprofessor,
								titulo          = $comunicado->Xtitulo,
								data            = $comunicado->Xdata,
								comentario      = $comunicado->Xcomentario,
								obrigatorio     = $comunicado->Xobrigatorio
						WHERE comunicado = ".$comunicado->getId();
		}else{
			$query = "INSERT INTO tbl_comunicado (
								instituicao    ,
								curso          ,
								professor      ,
								titulo         ,
								data           ,
								comentario     ,
								obrigatorio    
						) VALUES (
								$comunicado->Xinstituicao, 
								$comunicado->Xcurso,       
								$comunicado->Xprofessor,   
								$comunicado->Xtitulo,      
								$comunicado->Xdata,        
								$comunicado->Xcomentario,  
								$comunicado->Xobrigatorio  
						)";
		}
		if(!$banco->updateSQL($query)) {
			throw new Exception("Erro ao atualizar / inserir Comunicado. (SQL: $query ) "); 
		}

		if (strlen($comunicado->getId())==0){
			$comunicado->setId($banco->insert_id());
		}

		if (is_object($comunicado->getCurso())){
			$query = "	INSERT INTO tbl_comunicado_aluno (comunicado,aluno)
						SELECT DISTINCT 
								".$comunicado->getId().",
								tbl_curso_aluno.aluno
						FROM tbl_curso_aluno
						JOIN tbl_comunicado USING(curso)
						WHERE tbl_curso_aluno.aluno NOT IN (
							SELECT aluno 
							FROM tbl_comunicado_aluno
							WHERE comunicado = ".$comunicado->getId()."
						)
						AND tbl_curso_aluno.curso = ".$comunicado->getCurso()->getId();
		}else{
			$query = "	INSERT INTO tbl_comunicado_aluno (comunicado,aluno)
						SELECT DISTINCT 
								".$comunicado->getId().",
								tbl_aluno.aluno
						FROM tbl_aluno
						WHERE tbl_aluno.instituicao = ".$comunicado->_login_instituicao."
						AND tbl_aluno.aluno NOT IN (
							SELECT aluno 
							FROM tbl_comunicado_aluno
							WHERE comunicado = ".$comunicado->getId()."
						)";
		}

		if(!$banco->updateSQL($query)) {
			throw new Exception("Erro ao atualizar / inserir Comunicado. (SQL: $query ) "); 
		}

		$query = "	SELECT 	tbl_comunicado.instituicao,
							tbl_comunicado.professor,
							tbl_curso_aluno.aluno
					FROM tbl_curso_aluno
					JOIN tbl_comunicado USING(curso)
					LEFT JOIN tbl_professor ON tbl_professor.professor = tbl_comunicado.professor
					WHERE tbl_comunicado.comunicado = ".$comunicado->getId();
		$banco = $this->getBancoDados(); 
		$comunicado = NULL; 
		$retorno = $banco->executaSQL($query); 
		if($retorno != NULL) {

			while($linha = $banco->fetchArray($retorno)) { 

				$sessionFacade		= new SessionFacade($banco); 
				$obj_instituicao	= $sessionFacade->recuperarInstituicao($linha["instituicao"]);
				$obj_professor		= $sessionFacade->recuperarProfessor($linha["professor"]);
				$obj_aluno			= $sessionFacade->recuperarAluno($linha["aluno"]);

				/* Envio de Email para Notificação */
				if (getRealIpAddr() != '127.0.0.1'){
					$mail             = new PHPMailer();

					$body             = $mail->getFile('emails/comunicado.html');
					$variaveis = array("{ALUNO}","{PROFESSOR}","{NOME_INSTITUICAO}","{LOGIN}", "{SENHA}","{KEY}","{P}","{A}");
					$valores   = array(	$obj_aluno->getNome(), 
										$obj_professor->getNome(),
										$obj_instituicao->getNome(),
//.........这里部分代码省略.........
开发者ID:nowakis,项目名称:TesteNet,代码行数:101,代码来源:class.comunicado.DAO.php

示例14: die

// Inicio conexion
$connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die("Problemas en la conexion");
mysql_select_db(DB_NAME, $connection);
$email = $_POST['email'];
$mail = new PHPMailer();
// defaults to using php "mail()"
//$mail->Mailer = 'smtp';
$mail->SMTPDebug = true;
$mail->From = EMAIL_FROM;
$mail->FromName = EMAIL_FROM_NAME;
//Headers
$headers['X-Mailer'] = 'X-Mailer: PHP/' . phpversion();
$mail->AddCustomHeader($headers);
$mail->Subject = COMPARTIR_SUBJECT;
$mail->AltBody = COMPARTIR_BODY_ALT;
$body = $mail->getFile('compartir.html');
$body = str_replace('{SERVER_NAME}', SERVER_NAME, $body);
$mail->MsgHTML("{$body}");
$mail->AddAddress("{$email}");
if (!$mail->Send()) {
    $err_mail = $mail->ErrorInfo;
    $output = '{ "success": "no", "error": "Error enviando el email." }';
} else {
    $output = '{ "success": "yes", "error": "" }';
}
// Cierre conexion
mysql_close($connection);
//validar todo lo que haga falta, campo a campo
$output = str_replace("\r", "", $output);
$output = str_replace("\n", "", $output);
echo $output;
开发者ID:rraaff,项目名称:las-moras,代码行数:31,代码来源:doCompartirEmail.php


注:本文中的PHPMailer::getFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。