• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

I need a code which fetches the new mails

I would like to make a prog. which forwards the new mails automatically to an other prog. How can I fetch the new mails ???
0
kapitany
Asked:
kapitany
  • 2
1 Solution
 
timberbtCommented:
I assume you are logging into a POP3 mail server?  You first to attach via Telnet to port 110.  Then send "User <usernamehere>" <ENTER> "pass <passwordhere>" Enter then you use the list command to show you how many emails you have.  You parse through that and find the highest number (i.e. 9 or 15) then use the "retr <messagenumberhere>" command to view the messages and the "dele <messagenumberhere>" to delete them when you are done.  Retr will simply print them to the screen so you capture that and send it where you wish or modify it how you wish.
0
 
kapitanyAuthor Commented:
Yep, it works fine. The problem is while I'm logged in the POP3 is kept locked so no other mail program can read form there. Outlook is checking this account every 1 minute. My problem is that I would like to have the email in two places. One is the forwarded place and one is the outlook. But if I keep locked the POP3 outlook can't download the email, and if I relese the lock I cant catch my mail. Do you have any idea how I can have both? It would be a possibility to forward the mail to two different place. One where outlook can download and an other where I can later forward, but how is it possible?? Any other idea is wellcomed !  Also a simple code would be nice to see how these POP3 login and checking works...
0
 
timberbtCommented:
Well I guess that depends on the pop3 server...but you're going to hit problems running from the same account if your Outlook is deleting mail off the server than too.  That'd mean everytime it retrieves one, it deletes it.  So that wouldn't be any good anyways, you can try making a rule in outlook to forward everything to another account that you would use the other program for.  Otherwise, you're going to end up trying to cooridinate timing procedures between outlook and your program, and you'd have to have outlook keep messages on the server, and your program would be forced to make decisions as to whether it already had the mail that was out there.   It makes life a lot more difficult in other words.
But in outlook you can just tell it to forward "All mail directly to me" and forward that to some other account.  You'll have to use the rules wizard for that, it doesn't have a canned one, but it's real easy to do.  That way if you really wanted, you could also just filter stuff.  *BUT* this means that you getting mail to the other account is dependant on your outlook being up and running, which isn't neccesarily good.  You may want to check with whoever runs the POP server, I know some have the capability to forward copies of one message to others.  I know some used that as a form of a distribution list like a listserv.  You email to 1 address and multiple people get it.  
Probably not the answers you were looking for...but....:) Do what you gotta do eh?  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now