Hey, i need your help :(.
Im working on a mail-downloader but it wont work (pop3) :(.
mail provider:www.gmx.net
It always say "Wrong ID+PW" why?
here is the code:
#include "stdafx.h" // includes are there ;)
//Prototypen
int startWinsock(void);
int main()
{
char buf[256];
long rc;
SOCKET s;
SOCKADDR_IN addr;
rc=startWinsock();
if(rc!=0)
{
printf("Fehler: startWinsock, fehler code: %d\n",rc); // failed
}
else
{
printf("Winsock gestartet!\n");
}
s=socket(AF_INET,SOCK_STREAM,0);
if(s==INVALID_SOCKET)
{
printf("Fehler: Der Socket konnte nicht erstellt werden, fehler code: %d\n",WSAGetLastError()); // Failed
return 1;
}
else
{
printf("Socket erstellt!\n");
}
memset(&addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(110);
addr.sin_addr.s_addr=inet_addr("213.165.64.22"); // pop.gmx.net
rc=connect(s,(SOCKADDR*)&addr,sizeof(SOCKADDR));
if(rc==SOCKET_ERROR)
{
printf("Fehler: connect gescheitert, fehler code: %d\n",WSAGetLastError()); // failed
}
else
{
printf("Verbunden mit gmx..\n");
}
recv(s,buf,sizeof(buf),0);
std::cout << buf << std::endl;
strcpy(buf, "user xxx@gmx.de");
send(s,buf,sizeof(buf),0);
//std::cout << buf << std::endl;
recv(s,buf,sizeof(buf),0);
std::cout << buf<< std::endl;
strcpy(buf, "pass xxx");
send(s,buf,sizeof(buf),0);
//std::cout << buf << std::endl;
recv(s,buf,sizeof(buf),0);
std::cout << buf<< std::endl;
closesocket(s);
WSACleanup();
system("pause");
return 0;
}
int startWinsock(void)
{
WSADATA wsa;
return WSAStartup(MAKEWORD(2,0),&wsa);
}
Here is a screenshot:
http://i29.tinypic.com/2cmpwcp.jpg
Thx :)
Daniel