mi connetto al server di posta e mi ricosce, ma i comandi dopo HELO vengono rifiutati
codice:
ecco la risposta dal server :

Server echoed1 '220 vsmtp3.tin.it ESMTP Service (7.0.019) ready
'
Server echoed2 '250-vsmtp3.tin.it Missing required domain name in EHLO, defaulte
d to your IP address [80.107.21.103]
250-DSN
250-8BITMIME
250-PIPELINING
250-HELP
250-AUTH=LOGIN
250-AUTH LOGIN CRAM-MD5 DIGEST-MD5 PLAIN
250-DELIVERBY 300
250 SIZE 29999104
'
Server echoed3 '500  command unrecognized
equired domain name in EHLO, defaulted to your IP address [80.107.21.103]
250-DSN
250-8BITMIME
250-PIPELINING
250-HELP
250-AUTH=LOGIN
250-AUTH LOGIN CRAM-MD5 DIGEST-MD5 PLAIN
250-DELIVERBY 300
250 SIZE 29999104
'
Server echoed4 '500  command unrecognized
equired domain name in EHLO, defaulted to your IP address [80.107.21.103]
250-DSN
250-8BITMIME
250-PIPELINING
250-HELP
250-AUTH=LOGIN
250-AUTH LOGIN CRAM-MD5 DIGEST-MD5 PLAIN
250-DELIVERBY 300
250 SIZE 29999104
'
Sending 'Connection Closing' command
codice:
Questo e' il pezzo del sorgente :

#define MESHELO "ehlo\r\n\0"    
#define MESQUIT "QUIT\r\n\0"    
#define MESHELP "HELP\r\n\0"    
#define MESNOOP "NOOP\r\n\0"    
...
int main(int argc, char *argv[])
{
	if ( argc < 2 ) Usage();

	if (strcmp(argv[1], "client") == 0 )
	{
		// initialize wsock32.dll, requesting winsock 1.1
		if (argc!=3 ) Usage();
		if (!InitializeWinsock (MAKEWORD(1,1) ) ) return 1;
		client(argv[2]);
		WSACleanup();
	}
	return 0;
}

void client(char * server_IP)
{
SOCKET fd; 			// "file" descriptor for the network socket
SOCKADDR_IN saddr;
char buf[MAX_STRING];

    struct hostent *h;

    if ((h=gethostbyname(server_IP)) == NULL) {  /* get the host info */
		error("gethostbyname");
        exit(1);
    }
    printf("Host name  : %s\n", h->h_name);
    printf("IP Address : %s\n\n",inet_ntoa(*((struct in_addr *)h->h_addr)));

	if ((fd=socket(AF_INET,SOCK_STREAM,0)) == INVALID_SOCKET)
		error("Client: socket not connected ");

	saddr.sin_family = AF_INET;
	saddr.sin_addr.s_addr = inet_addr(inet_ntoa(*((struct in_addr *)h->h_addr))); 
	saddr.sin_port = htons(PORT);
	
	// request connection to server socket (remote machine)
	if (connect(fd, (LPSOCKADDR) &saddr, sizeof(saddr)) == SOCKET_ERROR)
		error("Client: connect ");

	if( recv(fd, buf, sizeof(buf), 0) == SOCKET_ERROR )
		error("Client: receiving failure ");

	printf("Server echoed1 '%s' \n",buf);
	
	if( send(fd, MESHELO, strlen(MESHELO)+1, 0) == SOCKET_ERROR )
		error("Server: sending failure ");
 		
	if( recv(fd, buf, sizeof(buf), 0) == SOCKET_ERROR )
		error("Client: receiving failure ");

	printf("Server echoed2 '%s' \n",buf);
//----
	if( send(fd, MESHELP, strlen(MESHELP)+1, 0) == SOCKET_ERROR )
		error("Server: sending failure ");
 		
	if( recv(fd, buf, sizeof(buf), 0) == SOCKET_ERROR )
		error("Client: receiving failure ");

	printf("Server echoed3 '%s' \n",buf);

	if( send(fd, MESQUIT, strlen(MESQUIT)+1, 0) == SOCKET_ERROR )
		error("Server: sending failure ");
 		
	if( recv(fd, buf, sizeof(buf), 0) == SOCKET_ERROR )
		error("Client: receiving failure ");

	printf("Server echoed4 '%s' \n",buf);
//<<<<<
//---	
	printf("Sending 'Connection Closing' command\n\n");

	if (closesocket(fd) == SOCKET_ERROR)
		error("Client: closing socket ");
}