in reply to Locking a POP3 Mailbox

You simply want to use filesystem locks. Locking should be coordinated between all of the different mail subsystems, so you should find out what kind of file locking the mail delivery agent uses and use the same thing. Common locking protocols for mailboxes are just using flock or fcntl(LOCK_EX,...) to lock the mbox file, or create a mailbox.LOCK file. You would probably want to lock when the POP program started, so nothing changed underneath you.

Replies are listed 'Best First'.
Re: Re: Locking a POP3 Mailbox
by sgifford (Prior) on May 01, 2004 at 16:14 UTC
    Oh, maybe I misunderstood your question. Are you trying to deal with locking on the POP3 server end, or the client? If it's the client and all clients run on the same machine, again you can use filesystem locks. Just do open(LOCK,">>/tmp/lockfile"); flock(LOCK,LOCK_EX); before opening the POP connection, but with error checking and a lockfile that's not in a world-writable area.