Attention: Because the Base64 encoding increases 3 bytes from the original string to 4 bytes in the destination (as printable ASCII characters) the string to be encoded must not be longer than 190 characters.
Base64 encoding used in emails normally takes each string of 57 byte length. That leads to lines with a string length of 76 characters. Those lines are then separated by LF.
The following procedure encodes a binary file. The result is a text file (handle t) which then could easy be send by email:
PROCEDURE WriteB64(binary_file : STRING; t : INTEGER)
VAR rt : STRING = 'ramtext:bin'
VAR i, fs : INTEGER
copyfile(binary_file,rt); fs:=getsize(rt); i:=1;
WHILE i<=fs DO