Author Topic: Setting up EM to read multiple mailboxes with multiple nested folders  (Read 2081 times)


  • Member
  • *
  • Posts: 1
What is the best way to set up EM to read emails from multiple nested folders (not the inbox).

The workflow requirements by the client are that only email that has been filed into a subfolder should be imported into FM. The question is how to do this efficiently since their are multiple mailboxes and they are very large containing hundreds of subfolders and we don't want to only bring in the new emails.

Thanks in advance for the help.


  • God
  • Member
  • *****
  • Posts: 83
below is pseudo script to perform the operation that you want.  The idea is to iterate over each of the 'Mailboxes', open the desired folder in the 'Mailbox', and iterate over each message in the desired folder and import it.

Set Variable[ $mailbox ; PCEM_GetFirstRootFolder
 Exit Loop If( $mailbox ="!!ERROR!!" )
  Set Variable[ $r ; PCEM_OpenRootFolder( $mailbox ) //opens the specified root folder ]
  #insert error capturing to ensure that the root folder/mail box was properly opened
  Set Variable[ $r ; PCEM_OpenFolder( FolderPath ) // opens the specified folder]
  #insert error capturing to ensure that the desired folderwas properly opened
  Set Variable[ $r ; PCEM_GetFirstRecord //gets the first record in the folder
  #insert error capturing to ensure that the desired record properly opened
  #an inner loop to iterate over each message in the Folder
   Exit Loop If( $r <> 0 )  // exit if there are no more messages to be read in the folder
   #a record (mail? ) is opened...perform script to import the record
   #insert code to import the record
   #... end 'import the record' code
   #now get the next record in the folder
   Set Variable[ $r ; PCEM_GetNextRecord //gets the next record in the folder]
  End Loop
  #process the next mailbox/root folder
  Set Variable[ $mailbox ; PCEM_GetNextRootFolder ]
End Loop

Hope this helps.