Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/07/2010, 09:06
loqtor
 
Fecha de Ingreso: julio-2010
Mensajes: 50
Antigüedad: 13 años, 9 meses
Puntos: 1
No me funcionan los "\r\n" cuando intento agregar varios headers al mail

Buenas,

Estoy teniendo el siquiente problema, este es mi código con el cual estoy intentando enviar un mail

$style = fopen('style.txt', 'r');
$mensaje .= fread($style, filesize('style.txt'));
$mensaje .= '<body lang=ES-UY link=blue vlink=purple>' .
'<p class=titulo>¿Querés trabajar con nosotros?<o:p></o:p></p>' .
'<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=500 style=\'width:375.0pt\'>';

$mensaje .= '<tr>';
$mensaje .= '<td style=\'padding:0cm 0cm 0cm 0cm\'>prueba
<p class=MsoNormal style=\'line-height:13.5pt\'>' .
'<span style=\'font-size:7.5pt;font-family:"Verdana","sans-serif"\'>prueba
<o:p></o:p></span>'.
'</p>'.
'</td>';
$mensaje .= '</tr>';
$mensaje .= '</table>' .
'</body>' .
'</html>';

$headers .= 'From: Nuevo Siglo <[email protected]>\r\n';
$headers .= 'Content-Type: text/html; charset=\'iso-8859-1\'';

if(mail('[email protected]', 'Prueba CV', $mensaje, $headers))
{
echo 'El mail ha sido enviado';
}
else
{
echo 'el mail no pudo ser enviado';
}


style.txt tiene un css nomás y yo lo q hago es tomar ese contenido y ponerlo dentro del cuerpo d mail, en definitiva lo q estoy intentando hacer es mandar un msj con contenido html.

Bien, el problema es el siguiente, cuando recibo el mail veo esto en el asunto:

Nuevo Siglo nContent-Type: text/[email protected] [[email protected]]

Y el contenido no es correctamente convertido, sino que simplemente pone el html como texto plano.

Algo como esto:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">

<head>



<meta name=Generator content="Microsoft Word 12 (filtered medium)">

<!--[if !mso]>

<style>

v\:* {behavior:url(#default#VML);}

o\:* {behavior:url(#default#VML);}

w\:* {behavior:url(#default#VML);}

.shape {behavior:url(#default#VML);}

</style>

<![endif]-->


y sigue...

Si únicamente pongo el header para el "content type" el mail llega con el formato adecuado, pero obviamente va a parar a "correos no deseados", dado que no tiene un "from" seteado.

Por qué puede ser que no me esté tomando el "\r\n"??? O en que otra cosa puedo estarme equivocando??

Ya que el contenido está bien, dado que si excluyo la cabecera de "from" y dejo sólo la del "content type" el contenido se ve como debería.

Saludos y gracias de antemano.

Última edición por loqtor; 27/07/2010 a las 11:18