getting just the HTML
Posted: Fri Jan 26, 2007 8:12 pm
Hi, I'm using swift to send an email with a PDF attachment and html format.
Using Gmail i see my email perfectly. But when using hotmail or outlook the emails sometimes (and not always) are wrong. The email is recieved (sometimes as spam, and I'm sending it from a hosted email account). But you can see the Mime headers and the PDF attachmet as a bunch of characters.
This is the code I use to send the email (all my files are in iso-8859-15 encoding):
Any thoughts?
Wrong email recieved follows:
-----------
X-Mailer: Swift 2.1.17 by Chris Corbyn
Reply-To: <adpro@adventa.com.mx>
Subject: Cotizacion #23
Date: Fri, 26 Jan 2007 17:56:03 -0600
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="_=_swift-2877655045ba95132d9fb2.04412545"
Content-Transfer-Encoding: 8bit
From: Asesor Tres <sistemas@opengate.com.mx>
Message-ID: <45ba98e9.69bbb813.5757.ffffa811@mx.google.com>
X-OriginalArrivalTime: 27 Jan 2007 00:12:26.0960 (UTC)
FILETIME=[D3A68D00:01C741A7]
This part of the E-mail should never be seen. If
you are reading this, consider upgrading your e-mail
client to a MIME-compatible client.
--_=_swift-2877655045ba95132d9fb2.04412545
Content-Type: multipart/alternative;
boundary="_=_swift-121085068345ba95132da384.02698895"
--_=_swift-121085068345ba95132da384.02698895
Content-Type: text/html; charset="ISO-8859-1"; format=flowed
Content-Transfer-Encoding: 8bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang=es>
<head>
<title>ADPRO</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<link href='http://lcaguirre.opengate.com.mx/PhpMailer/screen.css'
rel='stylesheet' type='text/css' />
<link href='http://lcaguirre.opengate.com.mx/PhpMailer/estilo.css'
rel='stylesheet' type='text/css' />
</head>
<body>
<table border='0'>
<tr>
<td><img
src='http://lcaguirre.opengate.com.mx/PhpMai ... png'/></td>
</tr>
<tr>
<td> <h3><br />Lic. ALMA VILLANUEVA</h3> <p>Anexo encontrará la
cotización de artículos que amablemente nos solicitó.
Espero encuentre en el documento anexo, los artículos que cubran
perfectamente su requerimiento, presupuesto y el tiempo de entrega sea el
adecuado para ud. quedo a sus respetables órdenes para cualquier
información adicional.</p> <p>Atentamente;</p> <h3>Asesor Tres<br />
Ejecutivo de Marcas</h3> <hr /> <p>No dejes para ma?ana lo que puedes hacer
hoy</p> </td>
</tr>
</table>
<h1> </h1>
</body>
</html>
--_=_swift-121085068345ba95132da384.02698895--
--_=_swift-2877655045ba95132d9fb2.04412545
Content-Type: application/pdf; name="Proyecto.pdf";
Content-Transfer-Encoding: base64
Content-Description: Proyecto.pdf
Content-Disposition: attachment; filename="Proyecto.pdf"
JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAy
IDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0ZsYXRlRGVj
b2RlIC9MZW5ndGggNjUwPj4Kc3RyZWFtCniclVVNT9wwEL3zK+bYSmBiO3Gyt6YQ0La7tIUU9ep1
......
Using Gmail i see my email perfectly. But when using hotmail or outlook the emails sometimes (and not always) are wrong. The email is recieved (sometimes as spam, and I'm sending it from a hosted email account). But you can see the Mime headers and the PDF attachmet as a bunch of characters.
This is the code I use to send the email (all my files are in iso-8859-15 encoding):
Code: Select all
$mail->addPart($body, 'text/html', 'iso-8859-15');
$mail->addAttachment(file_get_contents("../pdf/docs/{$proyecto->id}.pdf"), 'Proyecto.pdf', 'application/pdf');
$mail->send($to, $_SESSION['user']->getEmail(), $_POST['subject']);
$mail->close();Wrong email recieved follows:
-----------
X-Mailer: Swift 2.1.17 by Chris Corbyn
Reply-To: <adpro@adventa.com.mx>
Subject: Cotizacion #23
Date: Fri, 26 Jan 2007 17:56:03 -0600
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="_=_swift-2877655045ba95132d9fb2.04412545"
Content-Transfer-Encoding: 8bit
From: Asesor Tres <sistemas@opengate.com.mx>
Message-ID: <45ba98e9.69bbb813.5757.ffffa811@mx.google.com>
X-OriginalArrivalTime: 27 Jan 2007 00:12:26.0960 (UTC)
FILETIME=[D3A68D00:01C741A7]
This part of the E-mail should never be seen. If
you are reading this, consider upgrading your e-mail
client to a MIME-compatible client.
--_=_swift-2877655045ba95132d9fb2.04412545
Content-Type: multipart/alternative;
boundary="_=_swift-121085068345ba95132da384.02698895"
--_=_swift-121085068345ba95132da384.02698895
Content-Type: text/html; charset="ISO-8859-1"; format=flowed
Content-Transfer-Encoding: 8bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang=es>
<head>
<title>ADPRO</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<link href='http://lcaguirre.opengate.com.mx/PhpMailer/screen.css'
rel='stylesheet' type='text/css' />
<link href='http://lcaguirre.opengate.com.mx/PhpMailer/estilo.css'
rel='stylesheet' type='text/css' />
</head>
<body>
<table border='0'>
<tr>
<td><img
src='http://lcaguirre.opengate.com.mx/PhpMai ... png'/></td>
</tr>
<tr>
<td> <h3><br />Lic. ALMA VILLANUEVA</h3> <p>Anexo encontrará la
cotización de artículos que amablemente nos solicitó.
Espero encuentre en el documento anexo, los artículos que cubran
perfectamente su requerimiento, presupuesto y el tiempo de entrega sea el
adecuado para ud. quedo a sus respetables órdenes para cualquier
información adicional.</p> <p>Atentamente;</p> <h3>Asesor Tres<br />
Ejecutivo de Marcas</h3> <hr /> <p>No dejes para ma?ana lo que puedes hacer
hoy</p> </td>
</tr>
</table>
<h1> </h1>
</body>
</html>
--_=_swift-121085068345ba95132da384.02698895--
--_=_swift-2877655045ba95132d9fb2.04412545
Content-Type: application/pdf; name="Proyecto.pdf";
Content-Transfer-Encoding: base64
Content-Description: Proyecto.pdf
Content-Disposition: attachment; filename="Proyecto.pdf"
JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAy
IDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0ZsYXRlRGVj
b2RlIC9MZW5ndGggNjUwPj4Kc3RyZWFtCniclVVNT9wwEL3zK+bYSmBiO3Gyt6YQ0La7tIUU9ep1
......