title: How to save HTML email as an outlook file using Python?
body: <p>Someone created a nice email template in outlook and sent it to me for automation. </p>
  
  <p>I opened the email in HTML, and used that HTML to recreate the exact email images, formatting and all.  </p>
  
  <p>I can send this email out just fine, but I was then asked if I could save all the email files in a folder so that one could click on it and have it open up in their outlook (a .msg file).</p>
  
  <p>I can save my email as an .mht and .elm file, but neither will open in outlook.  </p>
  
  <p>Seemed like an easy request...</p>
  
  <pre><code>  msgRoot = MIMEMultipart('related')...
    ...      
    ...
    msgAlternative = MIMEMultipart('alternative')
    msgRoot.attach(msgAlternative)
  
    msgText = MIMEText('no alternative text version')
    msgAlternative.attach(msgText)
  
  
    msgText = MIMEText("""
    ...
    ...#too much going on here to paste. formatting and attaching images.
    ...
  </code></pre>
  
  <p>The part where I can successfully save this as .mht file:</p>
  
  <pre><code>  with open("C:/LOCAL/test/"+var+'.mht', 'w+') as out:
          gen = email.generator.Generator(out)
          gen.flatten(msgRoot)
  </code></pre>
  
  <p>Is there an easy way to just save this as the .msg file so that it opens in the client?  Like a preloaded email file.  You open it, it's addressed etc... just need to hit send.</p>