I am trying to find a way to create a mail folder/ subfolder using IMAP. With UiPath mail activities, we can either move or read emails. There’s no option to create a mail folder.
I have managed to create a mail folder using outlook features. i.e. Microsoft.Office.Interop.Outlook. However, due to the size of the mailbox, it’s slow. Also, at times, outlook stops responding. Hence I want to create a mail folder using IMAP.
Is there any way to create a mail folder using IMAP? Scripts are also fine like python, vb, or PowerShell scripts.
The solution or threads you provided are dependent on the outlook application which is something I would like to avoid as outlook hangs at least once a day due to mailbox size. Hence using the outlook application to create custom folders is not an ideal solution for me. Also, the folder created through the outlook application doesn’t sync quickly which causes issues while IMAP activity is looking for the newly created folder.
Is there any other programmatic way to create a mail folder without using the outlook application?
Found a solution to create mail folders using IMAP programmatically with help of python. It’s quite easy. Posting the solution below so it would help the community.
import imaplib
M = imaplib.IMAP4_SSL("imap.example.org","port number in integer")
M.login("username", "password")
M.create("New Folder Name")
M.logout
Please note, you can create nested folder in one go as well. All you have to do is separate folder name by forward slash / e.g. Inbox/SubFolder1/SubFolder2