I used code found at the bottom of a tutorial at https://www.tutorialspoint.com/python/p ... _email.htm to send an email with a large text attachment. The attachment was stored as a .txt file in my RPi system, in which I was running python 2.7, I was elated to successfully send and receive an email with the attachment using the instructions. I was dismayed that the attachment showed up in my Outlook as a huge block of characters that included small and capital alpha characters and numeric characters but no symbols (e.g., #$";\ - etc.). (There is maybe a clue in there, but I could not figure it out.) I then sent a very short .txt file that included only "1 2 3 4" (without the quotes).
It came across as "MSAyIDMgNA" (without the quotes). I converted this to hex but that lead to no revelation.
I went back to the tutorial and found this sentence: "Attached files should be encoded with the pack("m") function to have base64 encoding before transmission. I spent 15 minutes trying to find out what this meant, to no avail. The description of struct.pack includes no parameter "m". Can someone clarify what was meant by the sentence? Or more generally, what I should do to the file at the point in the given code where the attachment is opened so that it is received as text?