can anyone explain how each of the attachments in a folder can be sent to different email accounts
Is there any rule for this action? Like attachment with the name XYZ goes to the person ZYX?
If you have a lot of mails to send maybe its some idea to sort those files before sending. If u have the same receipients, you can prepare lists of strings for each of them. After that u can create array of strings for files inside that folder (just simply assign array (strings) = directory.getfiles(“path to folder”)). for each (string type) file in array - based on some rule u can add to colection (by invoke method) your file (as string) to this collection (list). After that u will finish with ready to send collections, so you will be able to use it in send outlook mail message or with send exchange mail message
Other way is to copy those files to folders, then for each folder (which is mapped for each email account) create arrays of strings and send emails for each array. After finishing u can delete those folders.
Of course you can also send file by file (1 email = 1 file), but still as @Maciej_Witos mentioned before you should create some rules to assign those files for required mail account (like name of files, size of files, extensions or other business rules)