--- a/eric6/UI/EmailDialog.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/UI/EmailDialog.py Wed Oct 14 17:50:39 2020 +0200 @@ -276,7 +276,8 @@ name = os.path.basename(fname) if maintype == 'text': - txt = open(fname, 'r', encoding="utf-8").read() + with open(fname, 'r', encoding="utf-8") as f: + txt = f.read() try: txt.encode("us-ascii") att = MIMEText(txt, _subtype=subtype)