使用python从Outlook发送电子邮件

时间:2019-11-14 10:53:14

标签: python outlook-restapi

我正在尝试使用python从Outlook发送会议邀请。我也想在收件人的日历中反映出来。我正在使用以下代码

import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
def sendRecurringMeeting():    
  appt = outlook.CreateItem(1) # AppointmentItem
  appt.Start = "2018-11-14 15:30" # yyyy-MM-dd hh:mm
  appt.Subject = "Important"
  appt.Duration = 60 # In minutes (60 Minutes)
  appt.Location = "Floor 5"
  appt.MeetingStatus = 1 # 1 - olMeeting; Changing the appointment to meeting. Only after changing the meeting status recipients can be added
  appt.Recipients.Add("mabc@abc.com") # Don't end ; as delimiter
  appt.Recipients.Add("xyz@xyz.com")
  appt.ReminderSet = True
  appt.ReminderMinutesBeforeStart = 15
  # Set Pattern, to recur every day, for the next 5 days
  pattern = appt.GetRecurrencePattern()
  pattern.RecurrenceType = 0
  pattern.Occurrences = "1"
  appt.Save()
  appt.Send()
sendRecurringMeeting()

在这里,我正在尝试使用Python从Outlook发送会议邀请。通常,当我们发送会议邀请时,它将开始在他们的日历中显示您在提到的时间今天有会议。通过使用上面的代码,我可以发送会议邀请,但会议日历中未显示会议邀请,即未发出提醒。

0 个答案:

没有答案