Create a project with a Winsock control, and make it check for e-mail. It should have a button, "Check Mail", that when clicked checks the mail for the following e-mail account:
Server: | mail.geocities.com |
Username: | stunsoftware |
Password: | senalrat |
Somewhere on the screen, a message describing how many e-mails are available should be displayed.
For an e-mail server, generally you will see the following messages passing back and forth (for this project, only get the number of e-mails and stop there):
server ==) +OK mail.geocities.com POP3 server ready you ==) USER jdoe server ==) +OK Password required for jdoe you ==) PASS mypassword server ==) +OK jdoe's maildrop has 2 messages you ==) STAT server ==) +OK 2 2701 you ==) LIST server ==) +OK 2 messages (2701 octets) server ==) 1 1024 server ==) 2 1677 server ==) . you ==) RETR 1 (The server sends the entire text of message 1, line-by-line) you ==) DELE 1 server ==) +OK Message deleted you ==) QUIT server ==) Good-bye! |
Note that the above may or may not hold true depending on the type of server, and which commands you elect to send. Also note that, when message 1 is deleted, the message numbers are shifted. So, in this case, as soon as message 1 is deleted, the remaining message is #1.
The "best" way of doing the above is to use a variable, which keeps track of the message you just sent. So this variable, let's call it status
, equals "SentUser" and we get a "+OK ...", we know the USER message was received and we can send the PASS message and set the status
to "SentPassword". Of course, you can do this however you want; status
could be an integer.
Some functions that might come in handy:
Left$("Now is the time", 2)
returns "No"
Right$("Now is the time", 4)
returns "time"
Mid$("Now is the time", 8, 3)
returns "the"
(the first number is the position, the second is the number of characters)
Extra Improvements