Originally all email was plain text. Currently email can also be sent as HTML code. Obviously to use PHP to send out HTML emails, it is great to have at least a basic understanding of HTML code. To send HTML emails, it is necessary to instruct the email reader that we are dealing with more than just plain text. This is done with a few lines at the top. In the header section, before the sender name, put in a line with: "MIME-Version: 1.0\r\n" Then in the body of your email, put in boundaries between the different sections: Start with: "Content-Type: multipart/alternative;\n" Then identify each section Tell the mail program what you are using as a boundary between sections. This can be almost anything, but it is best to have some personal identification in the boundary. A string of characters with an = sign helps the boundary not be interpreted as text. "boundary=\"----=_NextPart_your.name_1234\"\n" Put in a boundary: "\"----=_NextPart_your.name_1234\"\n"; Then tell the email program what type section it is: "Content-Type: text/plain;\n charset = \"ISO-8859-1\" \n"; "Content-Transfer-Encoding: 8bit\n"; This is a plain text section..... Put in a new boundary: "\"----=_NextPart_your.name_1234\"\n"; Then tell the email program what type section it is: "Content-Type: text/html;\n charset = \"ISO-8859-1\" \n"; "Content-Transfer-Encoding: quoted-printable\n"; <html> <head> <title>HTML section</title> </head> <body> This is an HTML section. </body> </html> Close the section. "\"----=_NextPart_your.name_1234\"\n"; That is it. Be simple. Don't make the HTML very wide. Don't use CSS. |