Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

How to open Outlook and compose an email (but not send it) on MacOS?

$
0
0

I am trying to open outlook and then compose an email by adding the 'to' list and 'subject' but stop the process there, as I would want to edit the content specific to the email before sending it. The following code helps me open Outlook but I don't know how to proceed further with composing a new email:

opener ="open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, "/Applications/Microsoft Outlook.app"])

The following code works (I think) in Windows, but I am not sure how to use in macOS:

import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'xzy@email.com' 
mail.Subject = 'Paste subject here' 
mail.Body = 'Paste Body here'     
mail.display(False)�

Viewing all articles
Browse latest Browse all 29748

Trending Articles