MIME (Multipurpose Internet Mail Extensions) uses Base64 to send non-text files.
To encode data, you must first convert your content into a bytes-like object.
The Python base64 module is a built-in library, meaning you do not need to download or install it separately using pip. It comes pre-packaged with every standard Python installation. To use it, simply add this line to the top of your script: import base64 What is the Base64 Module?