Last active
October 21, 2019 07:15
-
-
Save itst/4e7d52df9cf17ee030ad330974e69178 to your computer and use it in GitHub Desktop.
To keep my IMAP account's inbox as small as possible, I move mails into yearly archives. I usually do that once every quarter. But if I don't, well then I have many mails to move. This AppleScript does the heavy lifting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Mail" | |
set _a to imap account "[email protected]" | |
set _i to _a's mailbox "INBOX" | |
set _ms to (messages of _i) | |
set numLog to 50 | |
set iteration to 1 | |
set iterationMax to number of _ms | |
log iterationMax & " msgs to move" | |
repeat with _m in _ms | |
if (iteration mod numLog is 0) then | |
log iteration | |
end if | |
set _rd to date received of _m | |
if (year of _rd is 2019) then | |
move _m to _a's mailbox "z-Archiv/2019" | |
end if | |
set iteration to iteration + 1 | |
end repeat | |
synchronize with _a | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment