ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Tool_Box/OutlookLib.py
Revision: 632
Committed: Mon Apr 3 19:21:49 2017 UTC (8 years, 11 months ago) by nino.borges
Content type: text/x-python
File size: 1093 byte(s)
Log Message:
Lib for interacting with outlook.  created this because of SOW Automator.

File Contents

# Content
1 """
2 OutlookLib
3
4 Created by
5 Emanuel Borges
6 03.15.2017
7
8 Just an Outlook library to make automating Outlook a bit faster for me.
9
10 """
11
12 from win32com.client import constants as c
13 import win32com.client
14
15 class OutlookConnection:
16 def __init__(self):
17 self.outlookApp = win32com.client.Dispatch("Outlook.Application")
18 self.outlookEmailItem = 0x0
19
20 def DraftEmail(self, emailTO, emailCC, emailSubject, emailBody, emailAttachment = None, bodyType = 'HTML'):
21 """Easy way to draft an email and wont send"""
22 newEmailMessage = self.outlookApp.CreateItem(self.outlookEmailItem)
23 newEmailMessage.Subject = emailSubject
24 newEmailMessage.GetInspector
25 if bodyType == 'HTML':
26 newEmailMessage.HtmlBody = emailBody
27 else:
28 newEmailMessage.Body = emailBody
29 newEmailMessage.To = emailTO
30 newEmailMessage.Cc = emailCC
31 if emailAttachment:
32 newEmailMessage.Attachments.Add(Source=emailAttachment)
33 newEmailMessage.Display()
34 #newEmailMessage.send()