... mes='Какой-то текст' # create message object instance msg = MIMEMultipart() # setup the parameters of the message password = app.config['MAIL_PASSWORD'] msg['From'] = app.config['MAIL_USERNAME'] msg['To'] = app.config['MAILTO'] msg['Subject'] = 'Письмо.' msg.attach(MIMEText(mes, 'plain','utf-8')) ... SMTPserv.sendmail(msg['From'],msg['To'],msg.as_string())
UnicodeEncodeError: 'ascii' codec can't encode characters in position 284-285: ordinal not in range(128)