Outlook 2007 receives html mail as a source with headers, other MUAs work fine. What for?

I have a few simple forms that send only html email. Most clients (Gmail, Lotus Notes 8, hotmail / live, Windows Live Streaming, Outlook Express) receive emails just fine, but Outlook 2007 does not.

The code is as follows:

$data="
            <html>
                <body>
                    <strong><u>$sub</u></strong><br><br>
                    <strong>Name:</strong> {$_POST["nombre"]}<br><br>
                    <strong>Phone:</strong>{$_POST["telefono"]}<br><br>
                    <strong>Email:</strong> {$_POST["email"]}<br><br>
            <strong>Subject:</strong> {$_POST["asunto"]}<br><br>
                    <strong>Question:</strong> {$_POST["consulta"]}</strong>
                </body>
            </html>";
            $header = "Reply-To: $from\r\n";
            $header .= "From: \"".$_POST["nombre"]."\" <$from>\r\n";
            $header .= "MIME-Version: 1.0\r\n";
            $header .= "Content-Type: text/html; charset=iso-8859-1\r\n";

            $enviado = mail($destino,$sub,$data,$header);

( $fromis the only part of the confirmation message)

The message received by the client is as follows:

Content-Type: text/html; charset=iso-8859-1
From: Consulta de "Boss" <boss@myfirm.com>
Reply-To: boss@myfirm.com
X-Mailer: PHP/

<strong><u>Solicitud de envío de recetas -
CLIENT</u></strong><br><br><strong>Nombre y Apellido:</strong>
Boss<br><br><strong>Email:</strong>
boss@myfirm.com<br><br><br>

Any ideas?

+3
source share
8 answers

, Outlook 2k3 2k7 ( HTML)

<?php
$header = "From: Sender <sen...@domain.org>\r\n";
$header .= "Reply-to: Sender <blabla...@domain.net>\r\n";
$header .= "X-Mailer: Our Php\r\n";

$boundary = "==String_Boundary_x" .md5(time()). "x\r\n";
$boundary2 = "==String_Boundary2_y" .md5(time()). "y\r\n";

$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/related;\r\n";
$header .= " type="multipart/alternative";\r\n";
$header .= " boundary="$boundary";\r\n";

$message = "If you read this, your email client doesn't support MIME\r\n";

$message .= "--$boundary\r\n";
$message .= "Content-Type: multipart/alternative;\r\n";
$message .= " boundary="$boundary2";\r\n";

$message .= "--$boundary2\r\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "Alternative message in plain text format.\r\n";

$message .= "--$boundary2\r\n";
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "<html><body><p>HTML formatted message</p></body></html>";

, , .

php SwiftMailer

: Outlook 2007 HTML, , </font>, , .

+8

, /r /n. Outlook hotmail /r/n.

+3

, Exchange janmoesen . CRLF LF, .

(, Microsoft, , 40% .

janmoesen ! .)

+2

Outlook 2007.

: \r\n \n

+2

HTML, :

$header .= "Content-Type: text/html; charset=iso-8859-1\r\n";
+1

HTML- MIME. , multipart/mixed (text/html). PHP, PEAR::Mail_Mime .

Outlook . ( ).

+1

Exchange ( Outlook) CRLF . , ( PHP Debian Postfix) , CRLF, Exchange. \r\n \n, . ( "RFCs !", ??)

YMMV, , , , Outlook, .

+1

Source: https://habr.com/ru/post/1730262/


All Articles