Mail tweaks on iPhone OS

From lensowiki
Jump to: navigation, search

Once, I had sent an email from an IMAP account on my iPhone. The message was sent fine, as the recipient then replied to it. On the iPhone, things seemed ok, as the message showed up in my Sent folder. However, the IMAP server itself had absolutely no awareness of the message. To rectify the problem, I attempted to move the message to a different folder. I tried the Inbox, Drafts, Inbox subfolders, etc. Nothing worked. The iPhone showed the message in the correct folder, but the server still had no knowledge of it. Not wanting to lose the message, I decided to explore the iPhone filesystem to see if I could recover the message somehow.

These instructions assume that your device is already jailbroken and you have installed OpenSSH to browse files on it and that you have iPhone OS 3.0 or higher on your device. If that's not the case, please visit the official Dev team website for instructions on how to jailbreak your device. Once that's done, open Cydia and install OpenSSH. Please immediately change your root password after you do this to prevent your device from being hijacked. Once that's done, you will need an SFTP client for your computer to browse and transfer files. That is beyond the scope of this tutorial, so Google is your friend.

To recover your message(s):

  1. Connect to your device
  2. Note that to prevent your phone's wifi from shutting off and potentially interrupting the process, you'll need to either
    • turn off auto-lock
    • tap your screen every so often
    • or install Insomnia
    • (or just work very very quickly :))
  3. Navigate to /private/var/mobile/Library/Mail
  4. Now open the folder corresponding to the email account from which you sent the message (should be self-evident)
  5. Open the .OfflineCache folder inside that. Note that you might need to turn on showing of hidden files in your SFTP client to see this folder in the first place

Now, inside this folder, you should see one or more files. Download all of the files to your computer and open them in any text editor to verify that they are what you are looking for. If so, append the .eml extension to them. Accept whatever warning your OS might throw up about changing/adding file extensions.

Finally, use a desktop email client to import the recalcitrant message (the .eml files) into the correct folder. Once you've verified that the message is on the server, you can delete the copy inside .OfflineCache if you want. If you'd rather play safe, just leave it there – the message will show up twice in whatever folder it's in when viewing on the phone, but the only thing that really matters is what's on the server.