title: How to send email with renederted html
body: <p>I'm try to send emial with renedered html. I render html with flask-bootstrap.
  When I send email with html Everything is fine, but when I send renedered html I got error:</p>
  <pre><code>UnicodeEncodeError: 'ascii' codec can't encode character '\u0107' in position 354: ordinal not in range(128)
  </code></pre>
  <p>My e-mail function:</p>
  <pre><code>def SendMSG(content):
      msg = MIMEMultipart()
      msg[&quot;From&quot;] = sender
      msg[&quot;To&quot;] = reciver
      msg[&quot;Subject&quot;] = 'test'
  
      msg.attach(MIMEText(content, &quot;html&quot;))
  
      ssl_pol = ssl.create_default_context()
  
      with smtplib.SMTP_SSL(smtp_server, port, context=ssl_pol) as server:
          server.login(sender, password)
          server.sendmail(sender, reciver, msg.as_string())
  </code></pre>
  <p>full error message:</p>
  <pre><code>File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1997, in __call__
      return self.wsgi_app(environ, start_response)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1985, in wsgi_app
      response = self.handle_exception(e)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1540, in handle_exception
      reraise(exc_type, exc_value, tb)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/_compat.py&quot;, line 33, in reraise
      raise value
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1982, in wsgi_app
      response = self.full_dispatch_request()
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1614, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1517, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/_compat.py&quot;, line 33, in reraise
      raise value
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1612, in full_dispatch_request
      rv = self.dispatch_request()
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/venv/lib/python3.9/site-packages/flask/app.py&quot;, line 1598, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/app/auth/views.py&quot;, line 47, in register
      SendMSG(rendered)
    File &quot;/home/roland/Dokumenty/GitHub/Forum_Flask/app/mailapp.py&quot;, line 35, in SendMSG
      server.sendmail(sender, reciver, msg.as_string())
    File &quot;/usr/lib/python3.9/smtplib.py&quot;, line 859, in sendmail
      msg = _fix_eols(msg).encode('ascii')
  UnicodeEncodeError: 'ascii' codec can't encode character '\u0107' in position 354: ordinal not in range(128)
  </code></pre>