Pop3 and gmail email deleted after download

4.3k Views Asked by At

I Am writing Pop3 client for gmail. The problem is that when the email is downloaded then it deletes from pop3 server. I have tried sending RSET command to server but it dose not work.

Do i have to send RSET just before disconnecting or after downloading each mail?

5

There are 5 best solutions below

0
On

Gmail's POP3 configuration maybe sometimes confusing. In the Gmail's web interface in "Settings" on "Forwarding and POP/IMAP" tab you can find a drop down list called "When messages are accessed with POP".

Here's the value list and the Gmail's behavior:

a. "delete Gmail's copy": Message is deleted by issuing RETR command.

b. "keep Gmail's copy in the Inbox": Message stays in the Inbox, Web interface says it's unread, however message is not received for the second time using POP3 client.

c. "archive Gmail's copy": Message is deleted by issuing RETR command, however it is possible to find it using web interface.

Gmail simply ignores DELE command, and does not follow POP3 standard.

2
On

It should only delete the messages if you send/use the DELE command. Since you're writing it yourself.. simply do not use the DELE command: http://www.faqs.org/rfcs/rfc1939.html

The RSET command should also work, too, see from the RFC linked:

RSET

     Arguments: none

     Restrictions:
         may only be given in the TRANSACTION state

     Discussion:
         If any messages have been marked as deleted by the POP3
         server, they are unmarked.  The POP3 server then replies

         with a positive response.

     Possible Responses:
         +OK

     Examples:
         C: RSET
         S: +OK maildrop has 2 messages (320 octets)

0
On

Google doesn't handle POP3 in a conventional sense. Once you have downloaded a mail then it is flagged as downloaded and POP3 will act like it has been deleted. But in reality they keep a copy of the mail on the server.

0
On

It has been some time, but working on a similar problem, i found out that the TOP command does not mark the message as read within GMail POP3 server.

So, if you do not read the message entirely, you can surely read it back later.

Hope it helps.

0
On

Because Gmail POP3 server doesn't work like normal POP3 server, it hides old emails automatically even the email was not deleted by POP3 DELE command.

If you want to read all emails from Gmail mailbox, you can try to implement or find a IMAP4 client. I can use IMAP4 to read all emails in Gmail mailbox.