Jump to content

HTML email using PHP


andyg1001

Recommended Posts

Hi,

 

I'm new to this forum and I'm teaching myself PHP for my own web site.

 

I'm planning on sending an HTML email when a customer signs up to my site. Any help would be much appreciated.

 

The problem I have is that the following code works perfectly well when viewed in webmail but does not work in Outlook 2003.

 

 

 

              <?php

                $to = "[email protected]";

                $subject = "HTML email";

               

                $message = "

                <html>

                <head>

                <title>HTML email</title>

                </head>

                <body>

                <p>This email contains HTML Tags!</p>

                <table>

                <tr>

                <th>Firstname</th>

                <th>Lastname</th>

                </tr>

                <tr>

                <td>Andy</td>

                <td>Gardner</td>

                </tr>

                </table>

                </body>

                </html>

                ";

               

                $headers = "MIME-Version: 1.0" . "\r\n";

                $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

                $headers .= "From: [email protected]" . "\r\n";

               

                mail($to,$subject,$message,$headers);

                echo ("email sent");

                ?>

 

The email that comes through in outlook 2003 is:

 

Content-type: text/html;charset=iso-8859-1 From: [email protected]

X-Cloudmark-Analysis: v=1.0 c=1 a=jTn-Q8FSfCO1nmyFLuUA:9 a=6lKGLFTiwgHrHopVnM8A:7 a=fiir3xXRFbs7AhB5_oMwtoVxEmMA:4

 

 

                <html>                <head>                <title>HTML email</title>                </head>                <body>                <p>This email contains HTML Tags!</p>                <table>                <tr>                <th>Firstname</th>                <th>Lastname</th>                </tr>                <tr>                <td>Andy</td>                <td>Gardner</td>                </tr>                </table>                </body>                </html>  

 

Thanks

 

Andy             

 

Link to comment
https://forums.phpfreaks.com/topic/160253-html-email-using-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.