PHP mailer containing HTML not showing correctly

Posted by kielie on Stack Overflow See other posts from Stack Overflow or by kielie
Published on 2010-03-29T20:56:34Z Indexed on 2010/03/29 21:03 UTC
Read the original article Hit count: 208

Filed under:
|
|

Hi guys, here is some code I've been working on, basically I need to set up a auto e-mail that gets sent to a user after they fill in a form, which at the moment it is doing, but the HTML is not displaying as it should inside of the email client.

I checked in Gmail, Outlook and Mac mail and none of them display the HTML correctly.

Here is the code

<?php
    session_start();
    $_SESSION['name'] = $_POST['name'];
    $name = $_SESSION['name'];
    $email_1 = $_POST['email_1'];
    $email_2 = $_POST['email_2'];
    $email_3 = $_POST['email_3'];
    $email_4 = $_POST['email_4'];
    $id_num = $_POST['id_num'];
    $tel = $_POST['tel'];
    $email = $_POST['email'];



    //sets the current date

    $curDate = date("Y-m-d");

    // Example


    require_once("mailclass/htmlMimeMail.php");
    $mail = new htmlMimeMail();
    $mail->setSubject("Your submission to MyWebsite!");
    $mail->setFrom("MyWebsite <[email protected]>");
    $mail->setFrom("MyWebsite <[email protected]>");
    $email_address = $email_1 . "," . $email_2 . "," . $email_3 ."," . $email_4 ;
    $mail->setBcc($email_address);





    $day = "
         <body style="'background: #000000; color: #FFFFFF;'">
         <div style="'background-image: url(http://www.website.com/images/mailerbg.jpg); width: 900px; height: 839px; margin: 0 auto;'">
         <div style="'width: 620px; height: 280px; position: relative; top: 155px; left: 25px;'">
                <h1><br>your friend $name<br><br><br></h1>
            </div>    
        </div>
        </body>";

    $mail->setHTML($day);   
            $result = $mail->send(array());

    ?> 

The code is pretty messy, from me screwing around with it so much, but basically none of the HTML shows up as it should in the email client once the message arrives at it's destination, how can I get it to display as a proper HTML page inside of the mail client?

I am assuming that my escaping is not done correctly, which is why nothing is showing as it should?

Thanx in advance!

© Stack Overflow or respective owner

Related posts about XHTML

Related posts about php