Table of Contents

24.3.1 Class Mime

The class Mime (gb.mime) provides you with seven constants and two methods.

The methods are necessary because, according to RFC 5322, you may only use characters from the 7-bit ASCII character set for a text e-mail. For all other contents, such as images - in an HTML e-mail or in the attachment - you must, according to RFC 2046 to RFC 2048, specify the coding method used for the characters of a MimeMessage part of the type MimePart in (special) header fields of an e-mail as MimeMessage. This is where the Multipurpose Internet Mail Extensions (MIME) come into play as an extension of the data format for e-mails.

With the two methods

you can use

Use the second parameter 'Encoding' to specify the encoding method to be used → Table 24.3.1.1.

24.3.1.1 Constants

The Mime class has these seven constants for specifying the method by which text is encoded or decoded:

constantvaluedescription
Default0This constant represents text encoded according to the standard procedure.
7Bit1This constant represents 7bit coded text (ASCII).
8Bit2This constant represents 8bit encoded text.
Binary3This constant represents binary coded text.
Base644This constant represents text encoded with the Base64 method.
QuotedPrintable5This constant represents text encoded with the QuotedPrintable method.
UUEncode6This constant represents text encoded with the UUEncoding method.

Table 24.3.1.1 : Constants of the class Mime

Information on the QuotedPrintable and UUEncode encodings can be found here:

24.3.1.2 Methods

The Mime class has only two methods:

MethodReturnTypeDescription
Decode ( Data As String, Encoding As Integer )StringThe function decodes the data ('Data') that was originally encoded using the encoding method specified in the 'Encoding' parameter.
Encode ( Data As String, Encoding As Integer )StringThe function encodes the data ('Data') with the encoding method given by the parameter 'Encoding'.

Table 24.3.1.2.1 : Methods of the class Mime

Notes:

24.3.1.3 Example text encoding

This is the original text:

Hallo,

das Kapitel 24.3.1 Mime (gb.mime) ist abgeschlossen und wurde heute veröffentlicht.

Mit flottem Gruß

Hans

and here you will find the encodings of the above text in Base64, QuotedPrintable and UUEncode one after the other:

Base64

SGFsbG8sCgpkYXMgS2FwaXRlbCAyNC4zLjEgTWltZSAoZ2IubWltZSkgaXN0IGFiZ2VzY2hsb3Nz
ZW4gdW5kIHd1cmRlIGhldXRlIHZlcsO2ZmZlbnRsaWNodC4KCk1pdCBmbG90dGVtIEdydcOfCgpI
YW5z

QuotedPrintable

Hallo,

das Kapitel 24.3.1 Mime (gb.mime) ist abgeschlossen und wurde heute ver=C3=
=B6ffentlicht.

Mit flottem Gru=C3=9F

Hans

UUEncode

M2&%L;&\L"@ID87,@2V%P:71E;"`R-"XS+C$@36EM92`H9V(N;6EM92D@:7-T
M(&%B9V5S8VAL;W-S96X@=6YD('=U<F1E(&AE=71E('9E<L.V9F9E;G1L:6-H

B2
Figure 24.3.1.3.1: Programme interface coding.