| 123456789101112131415161718192021222324252627282930 |
- '''
- Interface avec MS Outlook (via win32)
- @author: olivier.massot, sept. 2017
- '''
- import win32com.client as win32
- def display_mail(to, subject, content, attachments=[]):
- """ Créé et affiche le mail de réponse prêt à l'envoi """
- outlook = win32.Dispatch('outlook.application')
- mail = outlook.CreateItem(0)
- mail.To = to
- mail.Subject = subject
- mail.HtmlBody = content
- for path in attachments:
- mail.Attachments.Add(path)
- mail.Display(True)
- class Mail():
- def __init__(self, to, subject, content, attachments=[]):
- self.to = to
- self.subject = subject
- self.content = content
- self.attachments = attachments
- def display(self):
- display_mail(self.to, self.subject, self.content, self.attachments)
|