Problem
I am using a "logic app" in Azure to create a queue of incoming mails. The way the emails are registered are using a "message id", which is described as "a unique identifier for a message". I would like to be able to fetch emails over imap using this id - is this possible?
Logic app "message id"
- Example of "message id":
AQMkADAwATM3ZmYAZS0yNTYwLWNkZAAzLTAwAi0wMAoARgAAA-U4TGbG56lEtdoXy_23gW0HAKhWKDtf5AJErHyhh_b9NYQAAAIBDAAAAKhWKDtf5AJErHyhh_b9NYQAAAIFfgAAAA==
- Example of logic app:
What I have tried
I have tried just to download all emails as eml, and then to read them into notepad++ to see if the "message id" even exists in the eml-files, but they don't.
# Library for downloading emails
import imaplib
# Logging in
mail = imaplib.IMAP4_SSL("outlook.office365.com",993)
mail.login(email_user, email_pass)
# Downloading emails to eml
mail.select('Inbox')
typ, data = mail.search(None, 'ALL')
for num in data[0].split():
typ, data = mail.fetch(num, '(RFC822)')
f = open('%s/%s.eml' %("/my/path/", num), 'wb')
f.write(data[0][1])
mail.close()
mail.logout()