Hello,
I am trying to create custom plugin which will get emails from Microsoft Exchange mail and forward it to the Event Console.
Shortly:
I am using Check Mk 1.2.8p21 Raw
For my script I am using Python 2.7 and exchangelib
Server - Centos 7
My script:
import smtplib
from datetime import datetime, timedelta
import re, os
from exchangelib import DELEGATE, IMPERSONATION, Account, Credentials, FaultTolerance,
EWSDateTime, EWSTimeZone, Configuration, NTLM, GSSAPI, CalendarItem, Message,
Mailbox, Attendee, Q, ExtendedProperty, FileAttachment, ItemAttachment,
HTMLBody, Build, Version, FolderCollection
credentials = Credentials(
username=‘email@test.com’,
password=‘password’)
config = Configuration(retry_policy=FaultTolerance(max_wait=3600),
server=‘outlook.office365.com’, credentials=credentials)
account = Account(
primary_smtp_address=‘email@test.com’,
config=config,
autodiscover=False,
access_type=DELEGATE)
for item in account.inbox.all().order_by(’-datetime_received’)[:5]:
item.subject
item.sender
item.datetime_received
The above code is working perfectly in Pycharm.
My question is.
Did someone already faced with my problem? If the answer is yes, can you give some advice or share your code? If you know plugin which do the same thing, please share link.
Thanks,
Georgi