Python - Win32Com - Outlook - Forward today's sent items to an inbox

Viewed 7752

I am trying to create a script to forward each day all the Outlook's sent items from 8:00 AM on to a dedicated inbox.

The message has to be saved in the sent items folder of Outlook.

At the moment I have all the emails of today but the forward part of the script does not work (I do not have any error message)

EDIT 1: Thanks to Jimmy for the restrict idea!

import win32com.client as win32

outlook = win32.Dispatch("Outlook.Application").GetNamespace("MAPI")

outbox = outlook.GetDefaultFolder(6) 

messages = messages = outbox.Items.restrict("[SentOn] > '5/31/2017 08:00 AM'")

for message in messages:
    NewMsg = message.Forward()
    NewMsg.To = "mail@mail.com" 
2 Answers
Related