HTML E-Mail as fileattachment

Posted by johnny on Stack Overflow See other posts from Stack Overflow or by johnny
Published on 2014-05-30T09:08:18Z Indexed on 2014/05/30 9:25 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

I have a Problem with Outlook 2010. I sent an E-Mail with a Contactform with this Code:

  $message = '
        <html>
            <head>
            <title>Anfrage ('.$cfg->get('global.page.title').')</title>
            <style type="text/css">
                body { background:#FFFFFF; color:#000000; }
                #tbl td {
                    background:#F0F0F0;
                    vertical-align:top;
                }
                #tbl2 td {
                    background:#E0E0E0;
                    vertical-align:top;
                }
            </style>
        </head>
        <body>
            <p>Mail von der Webseite '.$cfg->get('global.page.title').'</p>
            <table id="tbl">
            <tr>
                <td>Absender</td>
                <td>'.htmlspecialchars($_POST['name']).' ('.htmlspecialchars(trim($_POST['email'])).')</td>
            </tr>
            <tr id="tbl2">
                <td>Betreff:</td>
                <td>'.htmlspecialchars($_POST["topic"]).'</td>
            </tr>
            <tr>
                <td>Nachricht:</td>
                <td>'.nl2br(htmlspecialchars($_POST["message"])).'</td>
            </tr>
            </table>
        </body>
        </html>';

        $absender = $_POST['name'].' <'.$_POST['email'].'>';
        $header  = "From: $absender\n";
        $header .= "Reply-To: $absender\n";
        $header .= "X-Mailer: PHP/" . phpversion(). "\n";
        $header .= "X-Sender-IP: " . $_SERVER["REMOTE_ADDR"] . "\n";
        $header .= "Content-Type: text/html; Charset=utf-8";
        $send_mail = mail($cfg->get('contact.toMailAdress'), "Anfrage (".$cfg->get('global.page.title').")", $message, $header);
  //$send_mail = mail("[email protected]", "Anfrage (".$cfg->get('global.page.title').")", $message, $header);
        $_SESSION['kontakt_form_time'] = time();
        $tpl->assign("mail_sent", $send_mail);

When I sent the email, doesn't shows the message. it generates a File named [NAME].h. The Message is in this File. How can I fix that, that the message shows in the E-Mail. Is this a Problem about the settings in Outlook?

© Stack Overflow or respective owner

Related posts about php

Related posts about html