Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a requirement (SpamAssassin 'training') to archive (or delete) two user's (users are junkmail and notjunkmail) inboxes at a given time every day if there is anything in them.

Can anyone help me with a script to do such a thing and where to put it and how to get launchd to fire it off at 6am every morning? I can figure out the launchd stuff; it's the moving of messages from inbox to, say, archive that is stumping me.

Script needs to run on the Server as these "users" will likely never log in.

Mac OS X Server 10.6 (soon to be upgraded to 10.7 if that matters)


share|improve this question

If you are running POP3 or IMAP for your server, getmail might solve your problem:

Configure it to fetch the mail from the IMAP server and put it into a folder which you can delete (or keep) afterwards.

Then call this from either a cron or launchd job at the desired time.

share|improve this answer

Sounds like a job for Automater (in your Utilities folder)! I don't have a Mac any longer, so I can't help you any further, but Automator would be worth checking out!

share|improve this answer
Hmm, I think Automator needs the user to be logged in for the Applescript to run...and if run as, say, a logged in admin user it won't be able to "see" into other user's inboxes to move the messages around. But if someone knows how to make this work I'm open to suggestion. – Meltemi Nov 18 '11 at 19:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.