from time import sleep
from exchangelib import Account, Credentials
a = Account(
'john@example.com',
credentials=Credentials('user', 'pass'),
autodiscover=True
)
while True:
for m in a.inbox.filter(subject__contains='My Trigger', is_read=False):
m.forward(
subject='Fwd: My Trigger',
body='Hey, look at this!',
to_recipients=['carl@example.com']
)
m.is_read = True
m.save(update_fields=['is_read'])
sleep(60)
如果您能够使用EWS而不是Graph API,请尝试一下exchangelib。比如:
相关问题 更多 >
编程相关推荐