In this recipe, we will see how we can display the body of our e-mail in HTML to our messages body. We will see how text may be displayed in bold, in various colors, for example, red and how to set the background color of the e-mail body. We will copy the program shown in the first recipe and make few changes in it. The detail of HTML coding is beyond the scope of this book. The focus of the recipe will be on how basic HTML code is shown in the e-mail body.
We will now carry out the steps shown as follows;
email_text
internal table, we will append a number of rows. Each row appended will correspond to the lines of the HTML code. We will specify a background color for the e-mail body. Then on the first line, we will write a text Dear Sir
in font size = 2
. On the next line, we will write text in red color. Finally, on the last line we write text in bold format, as shown in the following screenshot:create_document
method, the type of document specified will be HTML, rather than RAW in the previous recipes.We made a few changes in the program. First, we entered the entire HTML code in the form of an internal table. It should be made sure that the entire code is enclosed within <HTML>
and </HTML>
tags.
In the next step, the appropriate type (HTML) of the document that is to be created is specified for the method create_document
and the internal table containing the HTML coding is passed. The rest of the coding remains the same. The e-mail generated from the program appears as shown in the following screenshot:
We have used only one font size. However, within the HTML body we may have different font sizes.
3.143.17.27