in reply to Mail distorted

The problem you are having is because the lines are too long. Mail messages are limited to lines of 998 characters (1000 characters with the CRLF).

The Content-Type is irrelevant to the encoding. The type is for the client to determine how to present the attachment. It sounded you are sending a text file; text/plain is likely the right type to use.

If you can't shorten the lines in the file, then you need to use an Content-Transfer-Encoding. If you want to preserve the file, then base64 is the right encoding to use. If you just care about protecting high-bit characters and line lengths but don't care about control characters, then quoted-printable may work. The advantage of quoted-printable is that the attachment is still readable, just with non-ASCII values and line endings encoded with the equals signs you sometimes see.