Quote:
i want to write application in my fedora pc which retrieve my mails
from mailserver and application is able to read this email.
i m using c++ language.
another approach is
if above is not possible then
after my email comes from mailserver to my personalaccount (fedora pc)
i want to write application which retrieve email from my user account and want to read it from my application .
|
If I'm understanding you correctly, you're wanting to access your POP, IMAP, etc. email server programatically and thus retrieve your email... If that's correct, and your e-mail server provides POP access to messages stored on it (either directly or otherwise), and, you don't have to deal with SSL (at least, not at first; that would significantly complicate any such application), an app such as what I think you're describing is pretty straightforward to write.
First, I would suggest locating, obtaining and reading the RFC(s) (I'm not gonna tell you which one(s); finding out that information is part of the process) that pertain to sending and receiving electronic mail (hint: search for author last name = "Postel").
Then, get your app logic down with telnet (you type the lines that don't begin with '+'):
Code:
$ telnet some.pop.server 110
+OK A POP server somewhere ...
USER user@host.net
+OK Password Required
PASS password
+OK Maildrop locked, ready; 23405 bytes in 22 messages.
STAT
+OK 22 23405
QUIT
+OK Have a nice day
Lastly, get yourself a good TCP/IP reference. I've found W. Richard Steven's "UNIX Network Progamming, Volume 1" to suit my needs quite well in this regard. Much of TCP/IP, etc. seems simple, but really isn't; for example, just establishing a TCP connection is a process that involves a "three-way handshake". There are a lot of "gotcha's" in socket programming; you'll probably also spot a number of aspects of TCP/IP that are potentially vulnerable to attacks, such as DOS/DDOS attacks.
When you're ready to move on to C / C++, you'll likely be using the sockets API; you establish your connection with the remote host, exchange data with the remotehost, and finally, close your connection with the remote host:
Code:
if (gethostbyname(nameOfMailServer))
{
if (socket(...) < 0)
{
die();
}
if (connect(...) < 0)
{
die();
}
}
Next, you'll exchange data with the server using send() and recv() or other calls:
Code:
send(socket,pData,strlen(pData),0);
...
recv(socket,pData,sizeof(pData),0);
At the end of your app, you'll want to close the correct socket(s) in the correct manner so that the connection with the remote host is shut down correctly; at this point, you'll either need to understand sockets or have a good reference.
Hope that's what you're trying to do & that this helps.
- Larry