The SMTP Transporter class is a feature of 4D that allows emails to be sent using SMTP. When using the class various attributes can be defined to build an email to send out. The class contains two attributes used for the body of the email which are .textBody and .htmlBody. The first attribute, .textBody is a plain text format of the body, and .htmlBody is an HTML format of the body.
Due to the number of email clients and services, it can be useful to utilize both formats. However, if both formats are used, one format might be prioritized over the other. As such, if both formats are used, they should be respected properly. A plain text body may use characters such as \t for tabs and \n for new lines. When the same text is applied to the HTML body it will not render properly. The tabs and new line characters must use HTML entities.
For example, with the following text:
"Hello\nWorld" |
When applied to the .textBody and the email renders as plain text the result is:
Hello World |
When applied to the .htmlBody and the email renders as HTML the result is:
HelloWorld |
Alternatively, with the following text:
"1 < 4" |
When applied to the .textBody and the email renders as plain text the result is:
1 < 4 |
When applied to the .htmlBody and the email renders as HTML the result is:
1 < 4 |
Thus, while the SMTP Transporter Class has two body attributes, both do not have to be used based on the intended services and clients used. If both body attributes are used, make sure to properly format them, applying the same values to both may not return the same results.