How to Automatically Move Incoming Emails Between IMAP Folders
As a business, sometimes you may need to sort incoming emails by different IMAP folders.
For example, if all emails come to the same email account, it is reasonable to move support tickets to the folder checked by the support team, orders – to the folder monitored by the sales department, marketing emails – to the promotions folder etc. Your inbound email stream could be well organized and each department would not waste time for searching their messages in dozens or even hundreds emails in the Inbox.
The criteria to differentiate email messages can be some text in the Subject line or body, or sender email address, or the To email address.
Sorting emails manually by folders is a challenge when you receive a lot of messages each day.
But using G-Lock Email Processor you can automate this process.
Click here to download the 30-day trial version if you don’t have it yet.
Follow the steps below to create a rule to move emails to different IMAP folders.
Click on the “New Rule” on the menu bar.
Enter a rule name.
Choose the rule execution mode: on every message.
Click “Select” and choose an email message that you will use the debug the rule. You can save a message in the .eml format in advance.
Add the Field Extractor to the rule to extract the message Subject where
Source: Header field – Subject.
Add the Fields Processor to the rule.
Copy-paste the code below to the Fields Processor. You can add and remove code blocks yourself depending on how many folders you want to sort incoming emails by.
if pos('Ticket#', Subject)> 0 then
IMAP_Folder_to_Move := 'Tickets'
if pos('Word2', Subject)> 0 then
IMAP_Folder_to_Move := 'INBOX.Archive'
if pos('Word3', Subject)> 0 then
IMAP_Folder_to_Move := 'folder2'
Replace Ticket#, Word2 and Word3 with the real text or words from the Subject.
Replace Tickets, INBOX.Archive and folder2 with real full names of the folders as they exist on the server.
You can copy the full names of the folders from your Email Account settings.
Click on the “Retrieve” button, click on the folder and copy the folder full name from the field. Paste the folder name in the Fields Processor.
To leave email messages that were not processed by the rule, use the same folder in the Email Account settings as the folder you retrieve emails from and as the folder you move the emails to.
Download “Move Emails to IMAP Folders” Rule (.zip file)
G-Lock Email Processor is a powerful data parser and extractor for processing incoming emails.
Try it for free and move incoming emails to different IMAP folders automatically!
We used G-Lock to monitor our purchasing and extract the data into a database. Sometimes it has to process 1k mails, but no time there are any performance problems.
Either provide customized scripts if there something you want to do is not already implemented. So, you can feel free to do nearly everything you want.
The best thing at all is the Support – they will help you to solve every problem almost immediately, even if they must release a new version to fix a little bug.
Interested? Learn more about our email parsing software for Windows.
- How to Collect Data from Inbound Emails and Insert It into MS Access Database
- How to Build a PDF Report with Data Extracted from the Database
- How to Automatically Parse CSV Attachment to Database