I'm trying to send an email with the text of an txt file, the text is just a couple rows of text. The output I get when I run these is 'ascii' codec can't encode character '\xe9' in position 87: ordinal not in range(128)
bodyFloat = ("")
for differentNews in fileOpen:
bodyFloat = bodyFloat + differentNews
bodyFloat = bodyFloat + "\n"
sender = "sender@gmail.com"
reciver = ["reciver@gmail.com"]
password = "password"
body = str(bodyFloat)
print(body)
subject = "The daily news"
with smtplib.SMTP('smtp.gmail.com', 587) as mail:
mail.ehlo()
mail.starttls()
mail.ehlo()
mail.login(sender, password)
message = f'Subject: {subject}\n\n{body}'
mail.sendmail(sender, reciver,message)