Identifying messages with the check_for_msgs() function

This function is called for every discovered folder in the folder_traverse() function and handles the processing of messages. On line 110, we log the name of the folder to provide a record of what has been processed. Following this, we create a list to append messagesĀ on line 111 and begin iterating through the messages in the folder on line 112.

Within this loop, we call the process_msg() function to extract the relevant fields into a dictionary. After each message dictionary has been appended to the list, we call the folder_report() function, which will create a summary report of all of the messages within the folder:

103 def check_for_msgs(folder):
104 """
105 The check_for_msgs function reads folder messages if
106 present and passes them to the report function
107 :param folder: pypff.Folder object
108 :return: None
109 """
110 logger.debug("Processing Folder: " + folder.name)
111 message_list = []
112 for message in folder.sub_messages:
113 message_dict = process_msg(message)
114 message_list.append(message_dict)
115 folder_report(message_list, folder.name)