import smtplib as _smtp import email.header as _e_header import email.mime.text as _em_text wtc = u'\u0402\u0601\u0e44\u0f12\u13ca\u16bb '.encode('utf-8') tfc = b'ABCDEFGH ' tem = b'' sh = _e_header.Header(maxlinelen=200, header_name='Subject') sh.append(tfc + wtc + tem, charset='utf-8', errors='strict') fh = _e_header.Header(maxlinelen=200, header_name='From') fh.append(tfc + wtc + tem, charset='utf-8', errors='strict') th = _e_header.Header(maxlinelen=200, header_name='To') th.append(tfc + wtc + tem, charset='utf-8', errors='strict') print(str(sh)) print(str(fh)) print(str(th)) msg = _em_text.MIMEText(tfc + wtc + tem, 'plain', 'utf-8') msg['Subject'] = sh msg['From'] = fh msg['To'] = th print(msg.as_string()) #smtp = _smtp.SMTP_SSL('your.email.server') #smtp.login('your-email-account', 'your-email-password') #smtp.sendmail('you@your.email.server', # ['you@your.email.server'], # msg.as_string()) #smtp.quit()