Open main menu

lensowiki β

Changes

Mail tweaks on iPhone OS

2,922 bytes added, 02:56, 3 June 2010
Preventing MobileMail from trying to stay open/autolaunching: Minor clarifications
On this page I describe some Mail-related iPhone OS tweaks. Note that they assume that (1) your device is already jailbroken, (2) you have installed OpenSSH to browse files on it, and (3) you have iPhone OS 3.0 or higher on your device. If that's not the case, please [http://blog.iphone-dev.org 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 [http://www.iphonefaq.org/archives/97721 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 [http://www.google.com/search?q=browse%20files%20iphone%20openssh Google is your friend].
 
==Recovering offline, never-uploaded Mail messages==
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 [http://blog.iphone-dev.org 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 [http://www.iphonefaq.org/archives/97721 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 [http://www.google.com/search?q=browse%20files%20iphone%20openssh Google is your friend].
To recover your message(s):
#*turn off auto-lock
#*tap your screen every so often
#*or install Insomnia#*plug your phone into some sort of power source (power adapter or USB port)#*(just work very very quickly :))
#Navigate to <tt>/private/var/mobile/Library/Mail</tt>
#Now open the folder corresponding to the email account from which you sent the message (should be self-evident)
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.
 
==Preventing MobileMail from trying to stay open/autolaunching==
With iPhone OS 3.0, Apple introduced a behavior into SpringBoard such that the MobilePhone (Phone) and MobileMail (Mail) apps try to always stay open. Respringing results in these apps quitting and then relaunching. Furthermore, if you start a memory-intensive app, Mail will most likely get kicked out ''but SpringBoard will attempt to relaunch it as soon as possible''. This becomes very annoying, especially if you are on EDGE and have many email accounts, as Mail refreshes all accounts on startup and brings the entire OS to a grinding halt.
 
Unlike most other applications, whose persistence/restarting behavior is controlled by [[w:launchd|launchd]], this behavior is actually coded inside SpringBoard itself; as a result, you can't simply edit a [[w:plist|plist]] file in <tt>/System/Library/LaunchDaemons</tt> to change this. However, as communicated by [http://code.google.com/u/gaizin/ ashikase] in an email posted on [http://xsellize.com/threads/53536-Annoying-MobileMail.app-Auto-Launch/page2#post256908 xsellize], running <tt>strings</tt> on the SpringBoard binary serves up these two gems:
SBDisableMailAutoLaunch
SBDisablePhoneRelaunch
Now the problem is much easier. Here's what you need to do:
#Connect to your device via SSH (see above) using a terminal – this is key, we need to run some commands and not just modify files
#Enter <tt>launchctl unload /System/Library/LaunchDaemons/com.apple.SpringBoard.plist</tt> and hit enter
#Your phone will now show the spinning circle in the middle; this is fine
#Connect to your phone with an SFTP client
#Open <tt>/private/var/mobile/Library/Preferences/com.apple.springboard.plist</tt> in a plist editor
#To the root, add a key with name <tt>SBDisableMailAutoLaunch</tt>, type <tt>Boolean</tt>, value <tt>true</tt> (or checked, if using [[w:Property List Editor|Property List Editor]])
#Save file and upload back to device
#In the terminal, enter <tt>launchctl load /System/Library/LaunchDaemons/com.apple.SpringBoard.plist</tt> and hit enter
#Marvel at the results!
You'll notice (if you have [http://code.google.com/p/iphone-backgrounder/ backgrounder] installed and badges for Apple apps enabled) that the Phone app will start but Mail won't. Mission accomplished!
 
One important caveat: doing this will disable push email, as Mail needs to keep running for that to work, unfortunately. Mail will continue running after you switch to another app; however, if Mail is quit for whatever reason (using SBSettings, or due to low memory), it will '''not''' automatically reopen until you open it manually yourself. Scheduled email checking will also cease to take place when the app is no longer running.
Anonymous user