Move messages older than one day
property secondsInOneDay : 86400 tell application "Mail" set theInbox to mailbox "Inbox" of account "Exchange" set dateToday to current date set firstMessage to 1 set lastMessage to (get count of messages in theInbox) repeat with thisMessage from lastMessage to firstMessage by -1 set currentMessage to message thisMessage of theInbox set messageDate to date received of currentMessage set timeDifference to dateToday - messageDate if timeDifference ≥ secondsInOneDay then set archiveMailbox to (mailbox ("Exchange inbox archive" as string))