How can i connect to a pop3 server and show how many e-mails i have, and notify if i new e-mail arrived.
Thanks,
Miranda
How can i connect to a pop3 server and show how many e-mails i have, and notify if i new e-mail arrived.
Thanks,
Miranda
You'll have to use the TcpClient class.
TcpClient.Connect to connect to the server probably on the standard 110 port
Server should respond with an +OK (successful) message.
Next you'll have to send two messages. One for USER and one for PASS. The server should successfully acknowledge both messages.
Finally, you'll have to send messages for LIST and RETR messages.
I would suggest you start off with a console app that just successfully connects to the server and then add the USER, PASS messages and then LIST RETR messages. In other words, build it one step at a time.
Finally, if a GUI is desired, you can always "wrap" your console code in GUI code.
Ok, i made the connection, but how can i receive a notice when a new e-mail arrive? Would be a notice at the time it arrived, if i'm not connected with the program and connect it later, i won't receive the notice.
How can i do that?
Last edited by miranda; 01-05-2006 at 08:20 PM.
What i want to do is something like that:
http://msdn.microsoft.com/library/en...82003_fig2.gif
The VB code:
http://msdn.microsoft.com/library/de...un03282003.asp
The Pop3 protocol does not have a facility to provide a callback.
You need to query the POP3 server, see what's there, then decide if there's something new to report to the user
Yeah, i just dont't know how to know if the message is NEW or NOT got it?
What Fordy is saying is that POP3 itself doesn't tell you what's been read or not. You have to keep a record of what's been read and check the list yourself.
Another approach would be to use the NetStream class to occassionally query (set up a timer) the POP3 server with POP3 "STAT". You'll probably have to split up the total messages and total size from what is returned. Thus, if total messages differs from previous query then "you've got mail".
yeah but the program only tell if i have new messages, and if i delete some messages in my webmail?
numberoldmessages - numberofnewmessages right?