Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    50

    [C] utilizzare il protocollo SMTP

    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 ");
    }

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    50
    up

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    50
    up

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    50
    up

  5. #5
    dovresti leggerti l'rfc per capire ^^

    ti vengono rifiutati perché essendo un server pubblico per mandare la mail vuole l'autenticazione...e per fare il login gli va bene sia la cram, sia la digest e sia il login senza codifica (testo semplice)

    ti consiglio di metterti un server in locale (come ad esempio Mercury Mail 4 che è gratuito e abbastanza completo) in questo modo puoi fare tutte le prove...quando finisci la base puoi passare a mettere il supporto per l'autenticazione PLAIN (che è il + semplice tipo)

    cmq...
    Questo per i comandi base:
    http://www.ietf.org/rfc/rfc0821.txt
    http://www.ietf.org/rfc/rfc2821.txt

    per l'rfc sull'autenticazione cerca su google...o anche su ietf stesso...

    The fastest Redis alternative ... cachegrand! https://github.com/danielealbano/cachegrand

  6. #6
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    50
    Grazie.
    Ormai non speravo piu'in una risposta.
    l'rfc per l'autenticazione se non ho sbagliato la riverca e'il 2554.
    Ho scaricato la versione Mercury-32 v4.01, era questa che intendevi per installare il server SMTP?

    Ciao.

  7. #7
    Hai provato a "sniffare" le trasmissioni del tuo programma
    di posta elettronica?


  8. #8
    Originariamente inviato da vici_1
    Grazie.
    Ormai non speravo piu'in una risposta.
    l'rfc per l'autenticazione se non ho sbagliato la riverca e'il 2554.
    Ho scaricato la versione Mercury-32 v4.01, era questa che intendevi per installare il server SMTP?

    Ciao.
    si

    inoltre, se non erro, credo che anch'essa supporti l'autenticazione, ma non ne sono sicuro...in caso scarichi qualche mail server + pompato, anche se trial e la parte per l'autenticazione la fai li...tanto credo che 30 giorni bastino

    ti consiglio come prima cosa di implementare la modalità di autenticazione PLAIN, che è la + semplice...è in quel caso "sniffare" i dati, come ti hanno detto, può essere molto utile...ma per la digest e per la cram...devi comunque leggerti e capire bene l'rfc DD

    The fastest Redis alternative ... cachegrand! https://github.com/danielealbano/cachegrand

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    50
    Grazie per i consigli.
    Avete messo parecchia carne al fuoco, quindi, per sperimentare tutto,
    credo che per qualche giorno(forse qualche cosina di piu') non mi faro' sentire xche' il tempo libero e' quello che e'.

    A presto... spero con buone notize.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.