I want an AppleScript that will move emails from the Inbox into the Archive if they are held in the "Promotional Emails" folder AND are older than 30 days. However, I do not want it to move any emails that might be in the "Promotional Emails" folder but that are also in the "Receipts/Invoices" Smart mailbox.
So I set up a rule ("To_Archive" for Apple Mail to search for all emails older than 30 days and then run an AppleScript. However, it is not working. Would you please help me write my first script. Thank you for any help!
on perform mail action with messages these_messages for rule To_Archive
tell application "Mail"
if this_message is in mailbox "Inbox"
And if this_message is in mailbox "Promotional Emails"
And if this_message is NOT in mailbox "Receipts/Invoices"
then
move this_message from mailbox "Inbox" to mailbox "Archive"
end if
end tell
end perform mail action with messages
end using terms from```
So I set up a rule ("To_Archive" for Apple Mail to search for all emails older than 30 days and then run an AppleScript. However, it is not working. Would you please help me write my first script. Thank you for any help!
on perform mail action with messages these_messages for rule To_Archive
tell application "Mail"
if this_message is in mailbox "Inbox"
And if this_message is in mailbox "Promotional Emails"
And if this_message is NOT in mailbox "Receipts/Invoices"
then
move this_message from mailbox "Inbox" to mailbox "Archive"
end if
end tell
end perform mail action with messages
end using terms from```