At this point, we've collected a fair amount of information about messages and folders. We use this code block to export that data into a simple report for review. To create this report, we require the message_list and folder_name variables. On line 146, we check whether there're any entries in the message_list; if not, we log a warning and return the function to prevent any of the remaining code from running.
If the message_list has content, we start to create a CSV report. We first generate the filename in the output directory by passing our desired filename into the make_path() function to get the absolute path of the file that we wish to write to. Using this file path, we open the file ...