The smtplib.server.sendmail function in python raises UnicodeEncodeError: ‘ascii’ codec can’t encode character

I am trying to edit a text file then send it as email body using a python script but im getting the unicode encoding error. After some research i found the solution as using the method .encode(‘utf-8’) but this doesn’t serve me as the sendmail() method only sends strings