I have used an open source code from CodeProject to read email from incoming mail server(POP Server). The code can be found at following location: http://www.codeproject.com/KB/IP/Pop3MimeClient.aspx
So far it works fine; I can read emails.
My objective of using this code was to retrieve emails from a POP server and process them.
My problem is: If I use Gmail's pop server "pop.gmail.com" and run the appplication, I get only those emails that I have not retrieved since the last time I ran the application. But if I use my client's POP server every time I run the application I get all the emails in the pop server.
For example:
If I use Gmail POP server: pop.gmail.com
I have three emails in the pop server.
I haven't run the application. I am running the application for the first time.
Application reads the email; this time I will get all three emails.
I run the application second time; my application will not read any emails this time because I have already read the 3 existing ones. This is fine; this is what I want.
Now I send an email to pop.gmail.com. I run the application again for the third time; this time I will only get the email that has just arrived, that is the fourth one. This is good behaviour; this is what I want.
But if I use my client's POP server:
No matter how many times I run the application, it reads all the emails in the mail box.
This will create a problem for me, because I am thinking of building a window service that will read emails from pop server and process them. This service will run continuously. I will process emails in the POP server then sleep for let's say 1 minute and the process the emails again. If the application downloaded from CodeProject reads all the emails all the time, my clients mailbox can have like thousands for email in this mail box, so this would not be feasible for me.
Are there some settings that are to be made at my client's POP server that will allow my application to retrieve only those emails that I have not read since last time I ran the service?
The server that stores this mail and then sends it to your inbox is called an incoming mail server. It may also be referred to as a POP, POP3, or IMAP server. POP is short for Post Office Protocol and IMAP is short for Internet Message Access Protocol.
POP stands for Post Office Protocol, and was designed as a simple way to access a remote email server. The most recent version is POP 3, and is supported by virtually all email clients and servers. POP works by downloading your emails from your provider's mail server, and then marking them for deletion there.
Do not use Gmail's implementation of POP or IMAP as canonical; both of these protocols behave differently with Gmail accounts than with virtually any other server.
To answer your question, you have two approaches that you can take:
DELE
command after downloading a message, which will remove it from the server.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With