Action based on number of emails after sort by from

Jeff Gellman

Member
Outlook version
Outlook 2016 32 bit
Email Account
POP3
Operating system::    Windows 10 (64)
Outlook version:     Outlook 365 desktop
Email type or host:    Microsoft 365 / Catch All box

As I have have great difficulties getting the RULES section of Outlook 365 to consistently perform with a 'catch all' box-- So...

I regularly sort the catch all box by sender address (and then do the same process with recipient address) and manually scroll through the results using CTRL-click to select each of the sorted result groups with at least three entries. Three was arbitrarily chosen as it indicates a "reasonably large" number of entries from the same sender.

I then mass delete all the selected results... and repeat the process sorted by recipient.

This maintenance process works well to keep the total number of emails down and doesn't take too long to perform. However, given the repetitive nature of the process, it seems that it should be relatively easy to create a script/macro/whatever that perform the sort and automatically select the appropriate headers for deletion based on the count of emails in each group.

Can anyone give me some suggestions where to start? I'm sure it could be done in VBA, but I'm looking for a simpler approach.

Thanks!

J.
 
Sorting is easy - getting the count is more difficult. That may or may not be slow, depending on the number of senders.

I have a macro that deletes duplicates by subject - it could look for by sender but it would delete more than 1 per sender, not if more than 2. It's slow.
 
Sorting is easy - getting the count is more difficult. That may or may not be slow, depending on the number of senders.

I have a macro that deletes duplicates by subject - it could look for by sender but it would delete more than 1 per sender, not if more than 2. It's slow.
As usual, "Diane to the rescue!" Over the years (like 20!) you have reliably been THE source for solving issues I have raised.

I see the basic strategy used in your macro and was wondering if it could be modified to manage a brute force (but more simplistic) method:

1. Sort the messages
2. Loop through each message, one at a time, incrementing each time the (for example) sender matches the previous email OR resets the counter if not.
3. Test if the count reaches 3 (or whatever) and if so, effect a delete of all the emails from that sender and restart the process at the next new sender in the big loop. OR alternatively:

I'd even be happy to simply delete the current email if it matches the prior-- effectively deleting duplicates and allowing a single loop through the emails. While this would leave the first dup in the mix, it would easily reduce the emails by all but one of the dups.

Of course, it would also be prudent to make sure the subject lines match before doing a delete--- but it is VERY rare that I am dealing with more than one subject line from the same sender. And since this is inside a catch all, the likelihood of losing something that MIGHT actually be valuable is really rare.

I think these strategies minimize the need to have a total count before removing duplicates.

Thoughts (AND, AGAIN, THANK YOU!)?

J.
 
>>
1. Sort the messages
2. Loop through each message, one at a time, incrementing each time the (for example) sender matches the previous email OR resets the counter if not.
3. Test if the count reaches 3 (or whatever) and if so, effect a delete of all the emails from that sender and restart the process at the next new sender in the big loop. OR alternatively:
>>

#1 is doable. #2 / 3 is where I need to think on it - obviously, looping works - but I'm trying to think how to do the count.
 
>>
1. Sort the messages
2. Loop through each message, one at a time, incrementing each time the (for example) sender matches the previous email OR resets the counter if not.
3. Test if the count reaches 3 (or whatever) and if so, effect a delete of all the emails from that sender and restart the process at the next new sender in the big loop. OR alternatively:
>>

#1 is doable. #2 / 3 is where I need to think on it - obviously, looping works - but I'm trying to think how to do the count.
Your approach is solid! Sorting the messages and then iterating through them makes the process efficient. Ty
 
As I have have great difficulties getting the RULES section of Outlook 365 to consistently perform with a 'catch all' box-- So...

I regularly sort the catch all box by sender address (and then do the same process with recipient address) and manually scroll through the results using CTRL-click to select each of the sorted result groups with at least three entries. Three was arbitrarily chosen as it indicates a "reasonably large" number of entries from the same sender.

I then mass delete all the selected results... and repeat the process sorted by recipient.

This maintenance process works well to keep the total number of emails down and doesn't take too long to perform. However, given the repetitive nature of the process, it seems that it should be relatively easy to create a script/macro/whatever that perform the sort and automatically select the appropriate headers for deletion based on the count of emails in each group.

Can anyone give me some suggestions where to start? I'm sure it could be done in VBA, but I'm looking for a simpler approach.

Thanks!

J.
You know, that consider using Exclaimer Signatures for Office 365. It automates email signature management, saving time and ensuring consistency without the need for complex scripting.

Might it work for you?
 
Similar threads
Thread starter Title Forum Replies Date
N "Perform a Custom Action" Outlook VBA and Custom Forms 0
S Command Button_Click action on Item/Reminder Outlook VBA and Custom Forms 3
F "This action is not available in the current mode" Using Outlook 0
Bri the Tech Guy Registry Tweak to make "Run a Script" Action Available Outlook VBA and Custom Forms 2
J Forward Action in Form Outlook VBA and Custom Forms 1
E you don't have permission to perform this action exchange 2016 Exchange Server Administration 0
I There is no email program associated to perform requested action Using Outlook 0
B Action Plans or Activity Sets in Outlook? Using Outlook 8
S Using "start application" rule action Using Outlook 2
R The action cannot be completed. The connection to Microsoft Exchange is unavailable. outlook must be Using Outlook 1
R send/receive no action Using Outlook 2
G Rule: IF mail received by X, THEN no action; IF mail not received by X, SEND Using Outlook 0
O Where is Launcher, the custom action for Exchange server? Exchange Server Administration 1
M send/ receive action too often Using Outlook 2
B Reply to All custom action doesn't work with attachments in Outlook 2007 Using Outlook 1
T getting an error This file does not have a program associated with it for performing this action. C Using Outlook 7
M Is there a RefreshNow action for Search Folder? Outlook VBA and Custom Forms 8
R could not complete your last action or actions BCM (Business Contact Manager) 2
D Running a Program from Custom Action Rule Outlook VBA and Custom Forms 1
L How to develop a custom action which can used in Rules Wizard? Outlook VBA and Custom Forms 2
A Error Message: The subject is not trusted for the specified action Outlook VBA and Custom Forms 3
B Upgrade to 2007, Action stopped working Outlook VBA and Custom Forms 3
D How can I make an action automatically make an appointment? Outlook VBA and Custom Forms 3
T Err - BCMgr contacts - Could not compl last action - try agin BCM (Business Contact Manager) 2
Q How do I create a custom action for a rule? (Save as "Nfy.MSG") Outlook VBA and Custom Forms 1
P How to clear out all contacts in iCloud, so I can use iCloud-based sync program Using Outlook 1
R Advise on using multiple instances of network files based on customers Outlook VBA and Custom Forms 8
whizzard Change FROM address based on TO or CC address Outlook VBA and Custom Forms 8
D Forwarding email based on the attachment file type and specific text found on the attachment file name Outlook VBA and Custom Forms 1
W Macro to Filter Based on Latest Email Outlook VBA and Custom Forms 6
A Macro to file emails into subfolder based on subject line Outlook VBA and Custom Forms 1
J Implement Keywords based on body message Outlook VBA and Custom Forms 0
T Outlook Template - textbox visible based on combobox selection Using Outlook 1
E Having some trouble with a run-a-script rule (moving mail based on file type) Outlook VBA and Custom Forms 5
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
geoffnoakes Outlook 2016 Searching based on CreationTime Using Outlook 3
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
V Change start time based on message duration Outlook VBA and Custom Forms 2
A Move email items based on a list of email addresses Outlook VBA and Custom Forms 40
Andrew Quirl Custom form to route requests based on input criteria Outlook VBA and Custom Forms 1
K Conditional Formatting based on Department of person received from? Outlook VBA and Custom Forms 4
L Office 365 cloud based rules Using Outlook 1
mctabish Setting "Reply To" based on inbox Outlook VBA and Custom Forms 2
H Select Specific Account When Sending Email, Based on Current Folder Outlook VBA and Custom Forms 1
icacream Rule based on sender / wrong sender sent to folder Using Outlook 7
D Moving Emails Based on Recipient/Sender Outlook VBA and Custom Forms 4
K Update subject based on text in body Outlook VBA and Custom Forms 3
A Sort emails into subfolders based on sender and deleting emails automatically Outlook VBA and Custom Forms 3
N automatic response with an attachment based on the subject line Outlook VBA and Custom Forms 1
M Move new mail to folder based on sender address Outlook VBA and Custom Forms 2

Similar threads

Back
Top