title: Can you use JavaScript inside an email, which is sent using Python?
body: <p>Can you use JavaScript inside an email, which is sent using Python?</p>
  
  <p>My aim is to send a working clock inside an email.</p>
  
  <p>I am trying to use Python to do so. I am using IDLE and the Python libraries stmplib, email and html2text to send emails. My code looks like the code shown below. I omitted some details (style and script) as they are unimportant. </p>
  
  <pre><code>me = "my.email@gmail.com"
  you = "my.email@gmail.com"
  
  msg = MIMEMultipart('alternative')
  msg['Subject'] = "Clock"
  msg['From'] = me
  msg['To'] = you
  
  html = """\
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;Clock&lt;/title&gt;
          &lt;style&gt;&lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="clock"&gt;
              &lt;p class="clockhour"&gt;HH&lt;/p&gt;
              &lt;p class="clocksym1"&gt;:&lt;/p&gt;
              &lt;p class="clockminute"&gt;MM&lt;/p&gt;
              &lt;p class="clocksym2"&gt;:&lt;/p&gt;
              &lt;p class="clocksecond"&gt;SS&lt;/p&gt;
          &lt;/div&gt;
          &lt;script type="text/javascript"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  """
  
  text = html2text(html)
  
  part1 = MIMEText(text, 'plain')
  part2 = MIMEText(html, 'html')
  
  msg.attach(part1)
  msg.attach(part2)
  
  s = SMTP('smtp.gmail.com:587')
  s.ehlo()
  s.starttls()
  s.login("my.email@gmail.com", "my password")
  
  s.sendmail(me, you, msg.as_string())
  s.quit()
  </code></pre>
  
  <p>The full version of the HTML in this code gives me a properly functioning clock, but if I attempt sending it to myself using Gmail I receive a different result.</p>
  
  <p>Viewing the HTML:</p>
  
  <p><a href="https://i.stack.imgur.com/7cqCP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7cqCP.png" alt="enter image description here"></a></p>
  
  <p>In Gmail:</p>
  
  <p><a href="https://i.stack.imgur.com/g9qKx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g9qKx.png" alt="enter image description here"></a></p>
  
  <p>This shows, that parts of the CSS load, but others like the font or the font size don't. It also shows that the JavaScript does not load. (Normally viewing the HTML code in a browser gives a functioning clock, while in an email doesn't.)</p>
  
  <p>Is there a way to send an email with this clock?</p>