title: How to open Outlook item with Python
body: <p>I am trying to create a python script to create outlook object to compose emails. I am using the following code.</p>
  
  <pre><code>import os
  import sys
  import win32.client
  
  
  def Emailer(text, subject, recipient):  
      outlook = win32.Dispatch('outlook.application')
      mail = outlook.CreateItem(0)
      mail.To = recipient
      mail.Subject = subject
      mail.HtmlBody = text
      mail.Display(True)
  
  Emailer('hello' , 'Wow it works' , 'hello@test.com')
  </code></pre>
  
  <p>But when I run the script I get an error;</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File
    "C:/Users/cnpanyog/Desktop/Mailtest.py", line 3, in 
        import win32.client ModuleNotFoundError: No module named 'win32.client'</p>
  </blockquote>
  
  <p>Then tried to search for win32 library by searching for 'win32' and could not find it. Then tried installing 'pypiwin32' and tried importing pypiwin32, then I get the following error</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File
    "C:/Users/cnpanyog/Desktop/Mailtest.py", line 3, in 
        import pypiwin32 ModuleNotFoundError: No module named 'pypiwin32'</p>
  </blockquote>
  
  <p>But I had installed it successfully</p>
  
  <p><a href="https://i.stack.imgur.com/1wmd1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1wmd1.png" alt="enter image description here"></a></p>