Stupid Mail.app

Mail.app decided it wanted to download all my messages again today. Fscking Sucks. But, I am a Coder! So, I spent a half hour playing with it, and figured out a solution to convince Mail.app it had already downloaded all the messages in my inbox.

Here’s a step-by-step guide to fixing your list of downloaded messages. It requires using the terminal. If you’re not comfortable with that, you’re probably out of luck.

First, you’ll need to grab you UID list from your mailserver. If you’re OK with connecting unsecured, simply fire up telnet, and connect to your mailserver on port 110. If you want SSL, it’s a little harder, but there’s actually a relatively painless way.  Use “openssl sclient -connect <mailserver>:995 -crlf”

Once connected, type “user <username>”, then “pass <password>”. If you’ve connected successfuly, it’ll respond “+OK”. They type UIDL, and it’ll return a list of message UIDs. Copy-Paste that to a textfile.

Next up, grab a copy of my script: It writes the proper plist file for your messages. http://thomashahn.is-a-geek.com/fixUidls.txt

Rename that file to fixUidls.php, and chmod u+x it. Then, run it with the parameters “<inputUidFile> <outputUidFile>”. Don’t save this directly over your current UID file, just in case.

Once you’ve got the new UID file, copy it to “~/Library/Mail/<Account>/MessageUidsAlreadyDownloaded2” First, though, you should rename the file already there (if there is one) to .old.

When you next open up Mail.app, it shouldn’t download anything! Hurrah!