Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/10/2010, 03:34
davicito
 
Fecha de Ingreso: marzo-2009
Mensajes: 480
Antigüedad: 15 años, 1 mes
Puntos: 1
no puedo mandar correos con formato HTML

Hola a todos,
Tengo este pequeño script que lo que hace es mandar correos a traves del exchange.

Mi problema es que no puedo ponerle un simple <br> o un stylo.

¿Como podria solucioanr este problema? :S


Código PHP:
<?php
// Modify the path to this class file as needed. 
require_once("class_http.php"); 
require_once(
"class_xml.php"); 
// Change these values for your Exchange Server. 
$exchange_server "https://mail.ejemplo.com"
$exchange_username "user"
$exchange_password "pass"


$toaddresses "[email protected]"//TO email address
$ccaddresses ""//CC email addresse
$bccaddresses ""//BCC email addresses

//-------------------------------
$subject "titulo del correo";
$body "Esto es un ejemplo"// AQUI ESTA EL PROBLEMA, NO PUEDO PONER UN SIMPLE <br>
//-----------------------------



// We use Troy's http class object to send the XML-formatted WebDAV request 
// to the Exchange Server and to receive the response from the Exchange Server. 
// The response is also XML-formatted. 
$h = new http(); 
$h->headers["Content-Type"] = 'text/xml; charset="UTF-8"'
$h->headers["Depth"] = "0"
$h->headers["Translate"] = "f";
// Build the XML request. 
// This section must be against the left margin. 
$h->xmlrequest '<?xml version="1.0"?>';
$h->xmlrequest = <<<END
<a:propertyupdate   xmlns:a="DAV:"
xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:g="http://schemas.microsoft.com/mapi/"
xmlns:e="urn:schemas:httpmail:"
xmlns:d="urn:schemas:mailheader:"
xmlns:c="xml:"
xmlns:f="http://schemas.microsoft.com/mapi/proptag/"
xmlns:h="http://schemas.microsoft.com/exchange/"
xmlns:i="urn:schemas-microsoft-com:office:office"
xmlns:k="http://schemas.microsoft.com/repl/"
xmlns:j="urn:schemas:calendar:"
xmlns:l="urn:schemas-microsoft-com:exch-data:">
<a:set>
<a:prop>
<a:contentclass>urn:content-classes:message</a:contentclass>
<h:outlookmessageclass>IPM.Note</h:outlookmessageclass>
<d:to>$toaddresses</d:to>
<d:cc>$ccaddresses</d:cc>
<d:bcc>$bccaddresses</d:bcc>
<g:subject>$subject</g:subject>
<e:htmldescription>$body</e:htmldescription>
</a:prop>
</a:set>
</a:propertyupdate>
END;
// IMPORTANT -- The END line above must be completely left-aligned. No white-space.
// The http object's 'fetch' method does the work of sending and receiving the 
// request. We use the WebDAV PROPPATCH method to create or update Exchange items.
$url $exchange_server."/Exchange/" $exchange_username "/Borradores/".urlencode($subject).".EML";
if (!
$h->fetch($url0null$exchange_username$exchange_password"PROPPATCH")) { 
echo 
"<h2>There is a problem with the http request!</h2>";
echo 
$h->log
exit(); 
}
// You can print out the response to help troubleshoot. 
//echo "<pre>".$h->header."</pre><hr />\n"; 
//echo "<pre>".$h->body."</pre><hr />\n"; 
// Bonus tip! You can automatically open this new draft message for your user by 
// formulating an outlook URL. Then either redirect to the URL by uncommenting the
// header line below, or pop the URL in client-side javascript using window.open. 
#header("Location: outlook:drafts/~".urlencode($subject)); 
$g = new http(); 
$g->headers["Content-Type"] = 'text/xml; charset="UTF-8"'
$g->headers["User-Agent"] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)'
$g->headers["Cookie"] = 'sessionid='.$sessionid.'; cadata='.$cadata
$g->headers["Depth"] = "0";  
$g->headers["Translate"] = "f"
$g->headers["Destination"] = 
"$exchange_server/Exchange/$exchange_username/##DavMailSubmissionURI##/";
if (!
$g->fetch($url0null$exchange_username$exchange_password"MOVE")) {
echo 
"<h2>There is a problem with the http request!</h2>";
echo 
$g->log;
exit();
}
elseif(
$g->status 200 || $g->status >= 300)
{
echo 
"<h2>There is a problem with the http request!</h2>";
// You can print out the response to help troubleshoot.
//echo "<pre>".$g->header."</pre><hr />\n";
//echo "<pre>".$g->body."</pre><hr />\n";
echo $g->log;
exit();
}
else
{
//echo "<h2>Email Sent!</h2>";
// You can print out the response to help troubleshoot.
//echo "<pre>".$g->header."</pre><hr />\n";
//echo "<pre>".$g->body."</pre><hr />\n";
//echo "<pre>".$g->log."</pre><hr />\n";
}
?>