Source for file email.classe.php
Documentation is available at email.classe.php
* Envia email da forma convencional ou com html e attach de imagens.
* @author Paulo F Nhaia <paulo.nhaia@gmail.com>
/* $Id: email.classe.php,v 1.6 2007/03/16 15:00:51 mmerlone Exp $ */
die('Este script nao pode ser acessado diretamente!');
* Classe para envio de E-mail
* $mail = new mime_mail();
* $mail->from = "foo@bar.com";
* $mail->headers = "Errors-To: foo@bar.com";
* $mail->to = "bar@foo.com";
* $mail->subject = "Testing...";
* $mail->body = "This is just a test.";
* $mail->add_attachment("$attachment", "test.jpg", "image/jpeg");
* @param string $this->parts; = partes da mensagem, imagens CID, anexos e body
* @param string $this->to; = para quem a mensagem se destina formato de email �nico
* @param string $this->from; = de quem
* @param string $this->headers; = todos os cabecalhos de tipo mime... setado automaticamente.
* @param string $this->subject; = assunto
* @param string $this->body; = conteudo da mensagem
* @param string $this->charset = tipo de formata��o (Valor Default iso-8859-1)
* Seta a propriedade Charset
* $this->setCharset("utf-8");
* @param string $pCharset = tipo de codificação da mensagem
* $mail = new mime_mail();
* $mail->from = "foo@bar.com";
* $mail->headers = "Errors-To: foo@bar.com";
* $mail->to = "bar@foo.com";
* $mail->subject = "Testing...";
* $mail->body = "This is just a test.";
* $mail->add_attachment("$attachment", "test.jpg", "image/jpeg");
* @param string $message; = partes da mensagem, imagens CID, anexos e body
* @param string $name; = para quem a mensagem se destina formato de email �nico
* @param string $ctype; = de quem
* @return void add_attachment(string message, [string name], [string ctype])
function add_attachment($message, $name =
"", $ctype =
"application/octet-stream"){
"encode" => isset
($encode)?
$encode:
"",
* Build message parts of an multipart mail.
* $this->build_message();
* @param string $part; = Mensagem
* @return void build_message(array part)
$message =
$part[ "message"];
if (strpos($part["ctype"],"magex")!=
false) {
// esta parte � usada apenas para anexar imagens que estejam no texto html
// deve ser passado como paremetro imagex/tipo para que ele acione esta funcao.
$part["ctype"]=
str_replace("magex","mage",$part["ctype"]);
$partemessage=
"Content-Type: ".
$part[ "ctype"].
($part[ "name"]?
"; name = \"".
$part[ "name"].
"\"" :
"").
"\nContent-Transfer-Encoding: $encoding" .
"\nContent-ID: <".
$part[ "name"].
">".
} else if ($part["ctype"]==
"text/bodyhtml"){
//pega o que for tipomime text/bodyhtml e acrecenta como conteudo do documento no formato hrml
$partemessage=
"Content-Type: text/html; charset=\"".
$this->charset.
"\" \n".
} else if ($part["ctype"]==
"text/plain"){
//pega o que for tipomime text/plain e acrecenta como conteudo do documento no formato text
$partemessage=
"Content-Type: text/plain; charset=\"".
$this->charset.
"\" \n".
//adiciona qualquer arquivo na mensagem como anexo
$partemessage=
"Content-Type: ".
$part[ "ctype"].
($part[ "name"]?
"; name = \"".
$part[ "name"].
"\"" :
"").
"\nContent-ID: <".
$part[ "name"].
">".
"\nContent-Transfer-Encoding: $encoding\n\n$message\n";
* Build a multipart mail.
* $this->build_multipart();
* @return void build_multipart()
$multipart =
"Content-Type: multipart/mixed; \n".
" boundary = $boundary " .
"This is a multi-part message in MIME format." .
return $multipart.=
"--\n";
* Send the mail (last class-function to be called).
* $mail = new mime_mail();
* $mail->from = "foo@bar.com";
* $mail->headers = "Errors-To: foo@bar.com";
* $mail->to = "bar@foo.com";
* $mail->subject = "Testing...";
* $mail->body = "This is just a test.";
* $mail->add_attachment("$attachment", "test.jpg", "image/jpeg");
$mime .=
"From: ".
$this->from.
"\n";
Documentation generated on Sun, 09 Mar 2008 23:51:40 -0300 by phpDocumentor 1.4.0