1

We've run a custom pop3 server without problems for many years. But now some clients are trying to use iPhones and there is some mysterious incompatibility. For emails over a certain size (for tests we use around 32K) the iPhone just retrieves headers and the first 40 lines using the TOP command. It displays those lines, "This message is only partially downloaded", and a button to "Download remaining".

With our server it never retrieves the full message. Hitting "Download remaining" just sends a STAT command. With a test server running the Dovecot pop3 server it sends a RETR command as expected and displays the full message. I've also monitored the protocol exchange with a test AOL account which works as expected.

I obviously don't expect anyone to debug our pop3 server code but does anyone have a clue as to what the iPhone might be seeing that would make it behave this way - never sending the RETR? I've compared the protocol exchanges and can see no practical difference between the servers that work and ours. I've checked the message format (header lines + blank line + message body + single period on a line to terminate) many times.

Here is the protocol exchange for our server:

+OK MultiBase POP3 Server Ready
USER stuff3@example.net
+OK Name is a valid mailbox
PASS a
+OK Mailbox locked and ready
STAT
+OK 1 34572
UIDL
+OK
1 20110607123720000006
.
LIST
+OK 1 messages (34572)
1 34572
.
TOP 1 40
+OK message top follows
[--message headers + 40 lines--]
.
[--Download remaining button hit--]
STAT
+OK 1 34572

Here is the protocol exchange for the Dovecot server:

+OK Dovecot ready.
USER stuff
+OK
PASS a
+OK Logged in.
STAT
+OK 1 34732
UIDL
+OK
1 000000014dee8328
.
LIST
+OK 1 messages:
1 34732
.
TOP 1 40
+OK
[--message headers + 40 lines--]
.
[--Download remaining button hit--]
STAT
+OK 1 34732
RETR 1
+OK 34732 octets
[--full message--]
.

The iPhone seems to have the habit of not closing the connection any time soon so that's why there's no QUIT command in these exchanges.

Any suggestions or clues greatly appreciated.

cgateley
  • 11
  • 1
  • I'd strongly suggest migrating to IMAP. We've been bothered by customers a lot less about lost emails, duplicates etc. after phasing out POP3. I wonder if modern devices are thoroughly tested against POP3 anymore anyways. – jkj Jun 09 '11 at 12:53

1 Answers1

1

If the iPhone works correctly against the Dovecot server then I would doubt the problem is on the iPhone side of things. I would suggest putting a packet capture program on the server, starting a capture, and watching the communication between the iPhone and the server to look for clues. Maybe the server is terminating the TCP session before the RETR command is recieved from the iPhone. Look for a RST from the server or some other anamoly.

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
  • Thanks for the suggestion. I used the packet capture programs tcpdump and tcpflow to record the protocol exchanges shown. There's definitely no RST from the server. And I can keep hitting the Download remaining button on the iPhone and get a STAT command with proper response but never a RETR. I agree it's not an iPhone 'problem' as such but some incompatibility with our server that I can't for the life of me find. – cgateley Jun 08 '11 at 12:34