title: Send dynamic html file on mail
body: <p>I tried sending html on mail using <code>django-mailgun</code> but it sends whole HTML contain rather than just rendered HTML table. What I want, is to send rendered table on mail. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>def send_email():
    dict = [....]        #it contains list of data that I want to render 
    html_message = render_to_string('email.html', {'data': dict})
    msg = EmailMessage('Hello', html_message,'mailgun@sandboxccd9ae5xxx6486546476d879gd.mailgun.org', ['abc@gmail.com'])
    msg.content_subtype = "html"  
    msg.send() 
  </code></pre>
  
  <p>Here's my HTML table:</p>
  
  <pre><code>  &lt;table style=" border:1px solid black; border-top:1px solid transparent; border-left:1px solid transparent; border-right:1px solid transparent; width:80%;  border-collapse: collapse; font-size:95%; margin-left:10%; margin-right:10%; margin-top:5%; "&gt;
      &lt;thead&gt;
          &lt;tr&gt;&lt;th colspan=5  style=" border-bottom:1px solid black; border-right:none; border-left:none; text-align:center; padding:4x"&gt;&lt;h4&gt;Activity List&lt;/h4&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr style="border:1px solid black"&gt;
              &lt;th style="border:1px solid black"&gt;col 1&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 2&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 3&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 4&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 5&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;body&gt;
          {% for item in data %}
          &lt;tr&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;{{ item.data1 }}&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;{{ item.data2 }}&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;{{ item.data3 }}&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;{{ item.data4 }}&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;{{ item.data5 }}&lt;/td&gt;
          &lt;/tr&gt;
          {% endfor %}
      &lt;/body&gt;
  </code></pre>
  
  <p>I am getting this on my mail:</p>
  
  <pre><code>&lt;table style=" border:1px solid black; border-top:1px solid transparent; border-left:1px solid transparent; border-right:1px solid transparent; width:80%;  border-collapse: collapse; font-size:95%; margin-left:10%; margin-right:10%; margin-top:5%; "&gt;
      &lt;thead&gt;
          &lt;tr&gt;&lt;th colspan=5  style=" border-bottom:1px solid black; border-right:none; border-left:none; text-align:center; padding:4x"&gt;&lt;h4&gt;Activity List&lt;/h4&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr style="border:1px solid black"&gt;
              &lt;th style="border:1px solid black"&gt;col 1&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 2&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 3&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 4&lt;/th&gt;
              &lt;th style="border:1px solid black"&gt;col 5&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
  
          &lt;tr&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 11&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 12&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 13&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 14&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 15&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 21&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 22&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 23&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 24&lt;/td&gt;
              &lt;td style="border:1px solid; text-align:right; padding: 4px"&gt;data 25&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;/tbody&gt;
  
  &lt;/table&gt;
  </code></pre>
  
  <p>
  </p>