Search code examples
amazon-web-servicesemaillambdaamazon-workmail

How to get messageId in aws workmail/ Iterate through workmail messages


I want to list all the messages in aws workmail and analyze them. The only function aws offers is

workmail = boto3.client('workmailmessageflow', region_name=os.environ["AWS_REGION"]

msg_id = event['messageId']

Here messageId can be retrieved from automation rule in aws workmail. This messageId persists and can be called days later, so there is a long term association between IDs and messages, but the only way to get this ID is upon workmail automation rule that triggers lambda. Is there any other way to figure out the messageIds or iterate through the workmail mailbox?


Solution

  • The Amazon WorkMail Message Flow API can be used to access email messages that are in transit only. To programmatically access messages that are already delivered to a user’s mailbox, use one of the other protocols supported by Amazon WorkMail, such as IMAP or Exchange Web Services (EWS).

    Source: Retrieving message content with AWS Lambda