Regularly synchronize IMAP folders in Mail
Jan 20, '05 09:09:00AM
Contributed by: Izzard
I met someone in a Macintosh chat room who said he needed a way to make Mail synchronize all the folders in his IMAP account. He had 30+ mail folders, and Mail was only updating the Inbox when asked to 'Check Mail.' He had checked the preference "Automatically synchronize changed mailboxes," but this was only happening when Mail was launched. I suggested making a tiny AppleScript to cause Mail to synchronize, as follows:
- Run "Script Editor" (it's usually in Applications -> AppleScript)
- Punch in this code:
tell application "Mail"
synchronize with account "Account Name"
end tell
Replace Account Name with the account name in Mail.app.
- Save as type "Application"
Now when you double-click your application in the Finder, Mail will synchronize your chosen account. You can, of course, run your application from the Terminal with open SyncMail.app, where SyncMail.app is the path/name you used when creating the application. You could also run it at regular intervals using cron or iCal. This is perhaps very simple and/or obvious -- but it was my first time using AppleScript, so I was pleased with it!
[robg adds: I haven't tested this, but you should also be able to save it as a simple script and put it in your user's Library -> Scripts -> Mail Scripts folder (create it if it doesn't exist), and then run it from the scripts menu icon within Mail.]
Comments (9)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20050117170158158