[Dovecot] IMAP IDLE - iPhone?
Hi All,
Probably a very common question now days. I'd like to configure our iPhones at work to go directly to my dovecot server (currently dovecot-2.0.9-2.el6_1.1.x86_64). Using the IMAP IDLE (push email) protocol.
Has anyone successfully deployed this? If yes, did you have to use an app from the Apple store? For me the IMAP process works, however it's clearly not notifying the client when new email is detected on the server.
cya
Craig
Related question that came to my mind: Does anyone know if XAPPLEPUSHSERVICE feature can be implemented by any server, or does it require cooperation between the server and the mobile network operator? I'm guessing the latter..
Hi,
On 10-Aug-12 4:48, Timo Sirainen wrote:
Related question that came to my mind: Does anyone know if XAPPLEPUSHSERVICE feature can be implemented by any server, or does it require cooperation between the server and the mobile network operator? I'm guessing the latter..
the Apple push service for Mail.app uses the same push notification service as all other push notifications for iOS (APNS, Apple Push Notification Service). The Device retains a persistent connection to Apple's APNS Gateway.
To transmit a push notification via APNS, the sender needs a certificate issued by Apple for the receiving application (Mail.app in this case). One can get such a certificate by purchasing Lion Server, which includes such a certificate (I presume Mountain Lion Server does as well).
The Lion Server uses dovecot, and Apple's patch for the XAPPLEPUSHSERVICE extension is available on http://www.opensource.apple.com/source/dovecot/dovecot-239/dovecot/src/plugi...
It basically works as following:
- Dovecot advertises the XAPPLEPUSHSERVICE Capability
- When the device logs in to the IMAP server and sees that it supports this capability, it registers with the server for push notifications and provides its device id and the id of the corresponding mail account on the device. These two ids are required to route a push notification to the device.
- The server records all registered devices for an account. Upon an incoming mail for the account, it transmits a push notification.
- The device does not directly unregister; this is done using the feedback mechanism of APNS, which tells a service provider that a device does not wish to receive push notifications any longer.
The actual transmission of the push notifications to the APNS server is not part of the dovecot patch but a separate program. One can use the Net::APNS perl module (found on cpan) to fairly easily replicate that program. Apple's original is also available:
http://www.opensource.apple.com/source/dovecot/dovecot-239/dovecot.push-noti...
-Mike
P.S.: I'm not sure if one is allowed to do this, though.
dovecot@noboost.org said the following on 10/08/2012 04:44:
I used K-9 client on Android for one year with push, but I had to remove it and go back to integrated email client because it drained the battery.
Ciao, luigi
-- / +--[Luigi Rosa]-- \
Why do we want intelligent terminals when there are so many stupid users?
On 10.8.2012, at 9.31, Robin wrote:
Dovecot has by default:
imap_idle_notify_interval = 2 mins
So the phone needs to receive and send data every 2 minutes. Increasing this / disabling it entirely should help with power usage. But even then active TCP connections do eat up battery.
Am 10.08.2012 08:26, schrieb Luigi Rosa:
so simply do it
imap idle is often promoted as push mail but tec side it isnt "exactly" the same, in users eyes the result looks nearly equal
yes every service which let stay you online, robs power from battery but you can sync only manuall etc ( for sure then push makes no sense anymore )
however its a human related question, if i need mails always and everywhere and in "real time"
in my eyes , if its really urgent people should phone together *g
-- Best Regards MfG Robert Schetterer
10.08.2012 09:44, dovecot@noboost.org пишет:
iPhone will not notify for new mail in any folder, except INBOX - it's IMAP limitation. IMAP IDLE monitor only one selected folder. If you need notifying of new mail in copule of mail folders you shold look for ActiveSync realization. On small mailboxes it's z-push and tine20 for example - they can use IMAP server as backend.
Sergey S. Kovalev
Am 10.08.2012 09:08, schrieb Sergey S. Kovalev:
On small mailboxes it's z-push and tine20 for example - they can use IMAP server as backend.
z-push works nice here with android, also the new horde beta has now calender, abook, notes, mail sync
-- Best Regards MfG Robert Schetterer
Am 10.08.2012 09:08, schrieb Sergey S. Kovalev:
this may be a IPHONE limitation as all the apple clients are buggy like hell since years
i have a Android with K9, a lot of folders where messages are stored by sieve-scirpts and on my phone i can actively select which folders should be used for push
10.08.2012 15:16, Reindl Harald пишет:
Sure, it can do it in two ways: open several connections to imap server (one per folder) or periodically change current directory and get changes. But any of this solution will eat battery very fast, proportionally to count of folders to check. I think that battery life is the reason, why this feature is not implemented in iPhone. It will use only one IMAP connection.
Sergey S. Kovalev
Am 10.08.2012 10:46, schrieb Sergey S. Kovalev:
typically the client opens a connecton for each folder to check
But any of this solution will eat battery very fast, proportionally to count of folders to check.
and that is why K9 on android let you select which folders are relevant for you on the mobile and which should be completly ignored and display the selected in "common inbox"
I think that battery life is the reason, why this feature is not implemented in iPhone. It will use only one IMAP connection
so it is not "it's IMAP limitation"
how does help me "save battery" if i have a folder-structure maintained by sieve if i do not get my new mails?
it's a limitation from Apple because they have not the knowledge to implement relieable mail-clients see below the removed posting on apple-support (first paragraphs german but posting and answer from Apple below in english)
On 10.8.2012, at 12.21, Sergey S. Kovalev wrote:
Assuming NOTIFY extension isn't implemented by both. (Dovecot v2.2 hopefully will have it, and K-9 apparently is interested in adding it too after that.)
Like mentioned previously in this thread, you can disable the "ping"s in Dovecot. And even when they happen Dovecot makes them happen at the same time. So I think the power usage difference between 1 connection and 100 connections isn't much.
On 10/08/2012 10:25, Timo Sirainen wrote:
The battery consumption problem seems common, but understanding of it is poor...
The situation is simply:
- Waking up a 3G radio is expensive on power
- So prefer to do it less frequently and do a chunk of stuff, rather than doing a small amount of data quite frequently
- Every 30 mins is only 48 times a day. Every 15 seconds is massively more
- Different 3G networks have different parameters set which will dramatically affect battery life. ie they wait longer/shorter before allowing the radio to go idle once woken up. I don't know a good online resource to see these settings, my old Nokia had a utility to investigate things...
- Firewalls impose challenges on being silent for 30 mins at a time and may drop any NAT mappings
- The 3G network will almost certainly have a NAT in the way which guarantees you have a (probably very short) NAT timeout (perhaps 10 mins or perhaps less)
- Then there is tcp keepalive. Does Dovecot enable these? (Sorry, I should look in the code...). However, applications which enable it (eg optional in SSH) will trigger a default (I think) 75 second network packet
As Timo says, Dovecot tries to be clever and coalesce packets from checking multiple folders, but from memory there are limitations on this if you have multiple *accounts*? I think the hash is per email address and per IP ?
But of course if your emails turn up every few seconds, then you will be triggering wakeups every few seconds also.
I think if you tune things with that in mind, it's very possible to get very low battery usage. Using tcpdump on your mobile client to help tune things is a great help. Basically every stray packet is a killer for battery, hunt them down.
Cheers
Ed W
On 14.8.2012, at 11.04, Ed W wrote:
Yes.
However, applications which enable it (eg optional in SSH) will trigger a default (I think) 75 second network packet
It's something like 2 hours by default in Linux.
As Timo says, Dovecot tries to be clever and coalesce packets from checking multiple folders, but from memory there are limitations on this if you have multiple *accounts*? I think the hash is per email address and per IP ?
Yes, doesn't help with multiple accounts, because the hashed username is different (no IP). I guess this could be changed to be per IP just as well. I think I wondered about which one to use previously but didn't see any point in choosing IP over username, but yes, multiple accounts could be a reason, especially after the whole world is using only Dovecot. :)
But of course if your emails turn up every few seconds, then you will be triggering wakeups every few seconds also.
Maybe Dovecot could make this somehow smarter some day.. Or create a plugin that allows that.
On Tue, Aug 14, 2012 at 4:18 PM, Timo Sirainen <tss@iki.fi> wrote:
Yes, doesn't help with multiple accounts, because the hashed username is different (no IP). I guess this could be changed to be per IP just as well. I think I wondered about which one to use previously but didn't see any point in choosing IP over username, but yes, multiple accounts could be a reason, especially after the whole world is using only Dovecot. :)
<very-OT>I for one welcome our new Dovecot overlords</very-OT>
Sorry for the noise.
On 14.8.2012, at 11.18, Timo Sirainen wrote:
As Timo says, Dovecot tries to be clever and coalesce packets from checking multiple folders, but from memory there are limitations on this if you have multiple *accounts*? I think the hash is per email address and per IP ?
Yes, doesn't help with multiple accounts, because the hashed username is different (no IP). I guess this could be changed to be per IP just as well. I think I wondered about which one to use previously but didn't see any point in choosing IP over username, but yes, multiple accounts could be a reason, especially after the whole world is using only Dovecot. :)
v2.2 has this now: http://hg.dovecot.org/dovecot-2.2/rev/8d7f9e2d726c
On Thu, Aug 23, 2012 at 8:50 PM, Timo Sirainen <tss@iki.fi> wrote:
On 14.8.2012, at 11.18, Timo Sirainen wrote:
v2.2 has this now: http://hg.dovecot.org/dovecot-2.2/rev/8d7f9e2d726c
Is there a reason why 172.16.0.0/12 was left out of the change ^^ ?
-- .warren
On 23.8.2012, at 23.26, Warren Baker wrote:
Is it actually used? :) I've used 192.168 in my home network and all corporate networks I've seen have been 10/8. But yeah, I guess since there aren't more than those 3 I'll just add it (I thought there were more of them, but looks like they're reserved for other purposes).
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12-08-23 4:49 PM, Timo Sirainen wrote:
Well, here's a "We use it" if you need it..
It probably just makes sense to block all out all RFC1918 addresses..
Daryl Richards Isle Technical Services Inc. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlA2mUMACgkQbMWpShDgLrWMSQCfY9tBtDvgVuQDMjUbbNlyGkUb yNQAn2u1tHOZkZc7dugeXaLQ/mfmBFvP =lQb3 -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Timo Sirainen said the following on 23/08/12 22:49:
Is there a reason why 172.16.0.0/12 was left out of the change ^^ ? Is it actually used? :)
YES!
I have a big customer (400 PCs) with 172.16.0.0/16 internal network and a subnet of 192.168.0.0 for DMZ
I use it more than 192.168 when I create networks.
Ciao, luigi
/ +--[Luigi Rosa]-- \
Walk softly and carry a megawatt laser. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlA3CYkACgkQ3kWu7Tfl6ZSRaQCgy1YilsGEL7JXIDabKm+zSjZN cvEAoKYqE1ZjbR/g1XTiHUvlfpPuvWAE =RSAO -----END PGP SIGNATURE-----
On Thu, Aug 23, 2012 at 10:49 PM, Timo Sirainen <tss@iki.fi> wrote:
Is there a reason why 172.16.0.0/12 was left out of the change ^^ ?
Is it actually used? :) I've used 192.168 in my home network and all corporate networks I've seen have been 10/8. But yeah, I guess since there aren't more than those 3 I'll just add it (I thought there were more of them, but looks like they're reserved for other purposes).
Yeah as others have mentioned - also not sure whether it is worth the effort to support IPv6's 'private' network (fc00::/7)? I havent seen anyone making use of this for their v6 enabled sites but others may have input here.
thanks
-- .warren
On Fri, 24 Aug 2012 10:10:42 +0200 Warren Baker articulated:
I would personally recommend supporting it. If history teaches us anything, it is that sooner or later, and usually sooner, someone will require that block. Being prepared for it in advance would seem like the prudent thing to do.
-- Jerry ♔
Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header.
On 2012-08-24, at 7.01, Jerry <jerry@seibercom.net> wrote:
I wonder whether it would be better to make the exclusion list configurable.
As I understand it, the intention is to avoid treating connections through a load balancer or proxy as though they're the same client device. The assumption that private address = proxy is a fair default, but some sites will be using public addresses for their proxies. And that's only going to increase with IPv6.
--
Matthew Powell matthew@atom.net
Am 24.08.2012 13:18, schrieb Matthew Powell:
i doubt the ip is generally the wrong value to define something is the same client device, there are millions of networks behind NAT out there with a lot of clients usually connecting to the same mailserver via the same public IP and many of them have a workstation beside a mobile device using the same IMAP account
the same device = open connection, nothing else
The assumption that private address = proxy is a fair default
in my opinion this is generally the wrong direction
i do NOT like it when server software behaves different from my private LAN where services are tested than later after making the service public from the WAN
On 24.8.2012, at 14.18, Matthew Powell wrote:
The reason for this default exclusion list is exactly to avoid behaving badly in unconfigured systems. Normally people should be using Dovecot proxies and login_trusted_networks setting configured to avoid the problem entirely.
On 23/08/2012 21:49, Timo Sirainen wrote:
I specifically use 172.16.0.0/12 because others don't, I also specifically don't use 172.16.0.0/16, because if someone does use 172.16.0.0/12 they usually only use 172.16.0.0/16... It's easy for people to connect to my networks via a VPN connection, and generally not have any IP conflicts with their own RFC1918 ranges and not have to fiddle with NAT issues.
-- Regards,
Giles Coochey, CCNA, CCNAS NetSecSpec Ltd +44 (0) 7983 877438 http://www.coochey.net http://www.netsecspec.co.uk giles@coochey.net
Am 10.08.2012 11:21, schrieb Sergey S. Kovalev:
surely IT IS an argument
on a non-iPhone you can chosse what is important your agrumentation is even one argument more against iPhone
as proven by other devices there is no limitation
how does help me "save battery" if i have a folder-structure maintained by sieve if i do not get my new mails?
again: how does it help me if I NEED to check them?
and no, IMAP has no limitations proven by Android-client my Samsung Galaxy S3 has around 25 push folders
no problem with K9 mail to have them in my "common inbox" including my own sent messages while on the desktop i use the folder structure and my battery has a average lifetime of 1.5 days
participants (15)
-
Daryl Richards
-
dovecot@noboost.org
-
Ed W
-
Giles Coochey
-
Jerry
-
Luigi Rosa
-
Matthew Powell
-
Michael Stilkerich
-
Oon-Ee Ng
-
Reindl Harald
-
Robert Schetterer
-
Robin
-
Sergey S. Kovalev
-
Timo Sirainen
-
Warren Baker