Reputation: 441
Basically I have to create a client application in C such that it may be able to establish a POP3 connection with some email server (some sort of pretty basic version of outlook), which can be executed and managed through a Unix terminal. Regarding the email server, I chose gmail since it offers both POP3 and IMAP protocols for connecting to email client applications (as you might have guessed, I also have to do the same thing with IMAP protocol, thinking on asking the same question for IMAP later). I am working on top of the following code stored in this link:
http://savetheions.com/2010/01/16/quickly-using-openssl-in-c/
Click the link to see the code.
The only changes I have made to the code are:
#define SERVER "pop.gmail.com"
#define PORT 995
and
sslWrite (c, "GET /\r\n\r\n");
response = sslRead (c);
printf ("%s\n", response);
sslWrite (c, "USER [email protected]");
response = sslRead (c);
printf ("%s\n", response);
(I replaced my real email with a fake email for the purpose of asking this question.) So at this starting point I am already having trouble. The first ssWrite works fine because I receive the greeting response (+Ok plus stuff) from pop.gmail.com, but the next sslWrite doesn't work, because pop.gmail.com answers complaining with -ERR bad command.
So I would like to receive some suggestions about how to make the login work and also how to go further with other tasks such as retrieving email, seeing email, deleting email.
I would also appreciate if you could give extra help about how to do the same thing using the IMAP protocol. The constrains are the same: C language, only openssl and posix APIs allowed.
PS: it's not mandatory to make the connections with gmail necessarily, I just chose it because I thought it would be a good idea, but feel free to suggest any email servers that may be good options to accomplish these tasks if you think so.
Upvotes: 0
Views: 920
Reputation: 38538
I'll never understand how people expect to implement an internet protocol without actually reading the specification(s).
Where in the POP3 protocol specification does it describe the "GET /" command?
When you figure that out, you'll figure out the problem.
Upvotes: 2