title: Send a list to HTML Email
body: <p>I am currently working with a HTML email document. Now I want to present a list with information from my database. How do I present the list in a HTML email? I've tried following:</p>
  
  <pre><code>import smtplib
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  
  articles = ['hello', 2, 5, 'bye']
  
  me = "email@gmail.com"
  you = "email@gmail.com"
  subject = 'something'
  
  msg = MIMEMultipart('alternative')
  msg['Subject'] = subject
  msg['From'] = me
  msg['To'] = you
  
  html = """\
  
      {% for i in {articles} %}
          &lt;p&gt; {{ i }} &lt;/p&gt;
      {% endfor %}
  
  """.format(articles)
  
  part1 = MIMEText(text, 'plain')
  part2 = MIMEText(html, 'html')
  
  msg.attach(part1)
  msg.attach(part2)
  
  server = smtplib.SMTP('smtp.gmail.com:587')
  server.starttls()
  server.login("email@gmail.com", "password")
  
  server.sendmail(me, you, msg.as_string())
  server.quit()
  </code></pre>
  
  <p>I appreciate all the help. Thanks in advance.</p>