Skip to content

Commit

Permalink
Refresh inbox folder, prior to processing messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Meredith committed Aug 16, 2018
1 parent d3ee6b4 commit 1d29c50
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ews_cli/ews.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,14 @@ def filter_mail(self):
if self.account == None:
self.connect()

self.account.inbox.refresh()
total = self.account.inbox.total_count
idx = 1
if total > 0:
print("Getting mail in INBOX...")
print("Getting mail in INBOX...",flush=True)
inbox_items = self.account.inbox.all()
status = "Process msg {0} of {1}"
for item in self.account.inbox.all():
for item in inbox_items:
print(status.format(idx,total),end='\r', flush=True)
folder = self.filters.process_msg(item)
if folder != '':
Expand All @@ -146,7 +148,7 @@ def filter_mail(self):
print('Error moving msg into folder.', flush=True)
idx = idx + 1
print('\n')
self.account.inbox.refresh()


def show_mail(self):
if self.account == None:
Expand Down

0 comments on commit 1d29c50

Please sign in to comment.