
I’ve also noticed is that the Archive box contains a series of e-mails showing the incremental steps I’ve made in composing a Gmail e-mail. Yet I still see deleted e-mail in Archive. When I delete a Gmail e-mail in the Mac Mail app I always use the Trash icon, not the Archive icon. I can’t figure out how my mail gets in there and what's the best way to manage it. My question has to do with the Gmail Archive mailbox. The Archive folder then itself has a box/folder for what looks to be each of my IMAP accounts (some are Gmail, some are on my local ISP). In Mail under “Mailboxes” in the upper left column I’ve got folders labeled Inbox, Flagged, Draft, etc, and Archive at the bottom. I'm struggling to find the right variable and evaluation here.I’ve used Apple’s Mail program for years but I’m still confused about the Archive mailbox and would be grateful if someone could help me out. Sadly, "whose date sent is." doesn't seem to work either. My guess is that the evaluation "whose date received is less than" is improper for the "sent" folder.

This doesn't work for the "Sent" folder, however. Set archiveMailbox to (mailbox (destination_mailbox as string)) Repeat with eachMessage in _msgs_to_capture Set _msgs_to_capture to (every message of mailbox target_mailbox of account target_account whose date received is less than oldemaildate)

If unread messages shouldn't be moved, change the end of the variable definition to read "is less than oldsentdate and read status is true)

#Identify messages that need to be moved. on archive_email(target_account, target_mailbox, destination_account, destination_mailbox, oldemaildate) I can sort the "Inbox" and archive mail from there quite easily. I think I'm just having an evaluation problem. It is a tad annoying that Mail doesn't see "On My Mac" as a local account, so you need to adjust the code to blindly reference mailbox names. I'm not a fan of the way Apple handles mail archiving, so I dug into a few examples that others had written to sort mail and slapped a short script together to filter through my email and archive everything older than 90 days. So, I finally got tired of manually sorting and archiving email on my Mac to get around some archaic mailbox size limits.
