Sometimes your iPhone mail client just doesn’t go. You open mail, and it closes again. You can’t even delete the account from the Setup application. I’m not 100% positive, but I think this usually happens when you’ve restored your settings from a pre-2.0 phone (again, unsure whether it matters if the phone was pwned or not).
You could wait for Apple to fix this bug, but with the new jailbreak tool available for 2.0 firmware, help is at hand. Jailbreaking your phone is fairly trivial, but beyond the scope of this post.
Update: Now I see there is a “Mobile Terminal” app available on Cydia. If you’re desperate you can install that, run it, enter “su” to elevate yourself to root (you’ll need the “alpine” password) then skip down to the
cd /var/mobile/Library bit.
Update 2: Even easier, the BossPrefs application (available via Cydia) has an option to “Fix User Dir Permissions” (accessed via the “More” button). This does exactly the same thing as my fix below, but is heaps easier if you don’t understand Unix terminal commands.
Read on for the full details
So let’s run through what you need:
- One iPhone with 2.0 firmware, jailbroken and diced finely.
- One tablespoon of OpenSSH, installed using the Cydia installer on your iPhone.
- The IP address of your iPhone when connected via Wifi (sorry USB won’t work).
To grab the IP address, head into the Wifi settings, and tap the blue “more” arrow on the connected network:
Ok, now we need to connect to that IP address using SSH. I use the Terminal app on my Mac, but you could just as easily use PuTTy on your PC. In PuTTy you’ll need to just type in the IP address to connect to. On the Mac you want to type
ssh email@example.com into Terminal (where xxx.etc. is the IP address of the iPhone).
The first time you do this, you will get a long (as in 60+ seconds) delay as the iPhone computes some cryptography stuff (a key pair I think), then it will ask you if you want to accept the key pair. Obviously you do. Type “yes” on the Mac or just click “OK” if you are using PuTTy.
Now we have an interactive shell with the iPhone. Hopefully everyone knows some basic Unix shell commands, because they teach those at primary school nowadays right? Right?! Anyway… your mail is stored at /var/mobile/Library/Mail. Let’s take a look at that directory on an iPhone with “broken” mail by typing:
See that bit that says “root mobile” on the line tha ends in “Mail/”? That means the Mail directory is owned by user “root” and group “mobile”. This is a Bad Thing(TM). We want it to be owned by user “mobile”, which is the user under which all iPhone apps run. This is an easy fix using the chown command with “-R” (for recurse directories):
chown -R mobile:mobile /var/mobile/Library/Mail
All fixed. Now go and run your iPhone mail app and whoop with delight. That’s an order.
And I can’t leave without my standard nag: I OWN this piece of hardware. It’s mine. I shouldn’t have to hack it to fix it. Grrr.