Sending HTML code in Put some HTML in the message. An example would be: Hello World! Prepare for our arrival. We are starving!!! When you have entered all relevant data in the form, click the Send button, and check your e- mail. It will display with out the effects of your HTML: To Make HTML code run in your message we need to add some more headers.
Sending HTML by using Headers
Multipart Messages
How it Works This tells the client to look for additional “Content-type” information in the message, which includes boundary information. The boundary is what separates the multiple parts of the message. It begins with two dashes (--), and goes at the beginning of the message, between each part, and at the end. The HTML portion of our follows. Note the double dashes (--) in front of the boundary. Also note the use of two new lines (\n\n) on the Content- Transfer-Encoding line. Do not neglect those— the code will not work correctly without them. $message.= “--$boundary\n”; $message.= “Content-type: text/html; charset=iso \n”; $message.= “Content-Transfer-Encoding: 7bit\n\n”; $message.= $messagebody. “\n”; $headers.= “Content-type: multipart/alternative; boundary=\”$boundary\”\r\n”;
Next is the text portion of our . Note the similarity to the HTML portion. You do not need to include the same $messagebody here. In fact, you would usually include an alternate message in text format. $message.= “--$boundary\n”; $message.= “Content-Type: text/plain; charset=\”iso \”\n”; $message.= “Content-Transfer-Encoding: 7bit\n\n”; $message.= $messagebody. “\n”; This is the final boundary. Note the double dashes (--) at the end. This signifies that it’s the end of the . $message.= “--$boundary--”; This is used to set the boundary in our example $boundary = “==MP_Bound_xyccr948x==”;