From 541743031461539cddc82586f0be5c573ed4e956 Mon Sep 17 00:00:00 2001 From: EDT 2000 Jeffrey Stedfast Date: Tue, 23 May 2000 21:54:35 +0000 Subject: Added debug fprintfs, tested with a few messages (smtp_data): Fixed to use Tue May 23 17:49:21 EDT 2000 Jeffrey Stedfast * providers/smtp/camel-smtp-transport.c: Added debug fprintfs, tested with a few messages (smtp_data): Fixed to use data_wrapper_write_to_stream() * camel-mime-filter-smtp.c (filter): Modified to escape all lines beginning with a '.' and to place \r before each \n if one did not previously exist. Removed code to escape "From " as it was found to not be needed * providers/imap/.cvsignore: added file svn path=/trunk/; revision=3186 --- camel/providers/smtp/camel-smtp-provider.c | 3 +- camel/providers/smtp/camel-smtp-transport.c | 47 +++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 5 deletions(-) (limited to 'camel/providers/smtp') diff --git a/camel/providers/smtp/camel-smtp-provider.c b/camel/providers/smtp/camel-smtp-provider.c index c82755d481..d93b03edc4 100644 --- a/camel/providers/smtp/camel-smtp-provider.c +++ b/camel/providers/smtp/camel-smtp-provider.c @@ -32,8 +32,7 @@ static CamelProvider smtp_provider = { "smtp", "SMTP", - "For delivering mail by connecting to a remote mailhub using SMTP." - "(NOT YET TESTED!)", + "For delivering mail by connecting to a remote mailhub using SMTP.", 0, diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 79cd5e51e7..3386e00e73 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -192,12 +192,14 @@ smtp_connect (CamelService *service, CamelException *ex) /* check to see if AUTH is required, if so...then AUTH ourselves */ if (smtp_is_esmtp && esmtp_supported_authtypes) { /* not really supported yet, but we can at least show what auth types are supported */ - fprintf(stderr, "camel-smtp-transport: %s requires AUTH\n", service->url->host); + fprintf(stderr, "camel-smtp-transport::connect(): %s requires AUTH\n", service->url->host); num = g_list_length(esmtp_supported_authtypes); for (i = 0; i < num; i++) - fprintf(stderr, "Supported AUTH: %s\n", (gchar *) g_list_nth_data(esmtp_supported_authtypes, i)); + fprintf(stderr, "\nSupported AUTH: %s\n\n", (gchar *) g_list_nth_data(esmtp_supported_authtypes, i)); g_list_free(esmtp_supported_authtypes); esmtp_supported_authtypes = NULL; + } else { + fprintf(stderr, "\ncamel-smtp-transport::connect(): provider does not use AUTH\n\n"); } return TRUE; @@ -479,6 +481,8 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) cmdbuf = g_strdup_printf ("EHLO %s\r\n", host && host->h_name ? host->h_name : inet_ntoa(localaddr.sin_addr)); else cmdbuf = g_strdup_printf ("HELO %s\r\n", host && host->h_name ? host->h_name : inet_ntoa(localaddr.sin_addr)); + + fprintf(stderr, "sending : %s", cmdbuf); if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -501,6 +505,8 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) return FALSE; } + fprintf(stderr, "received: %s\n", respbuf); + if (smtp_is_esmtp && strstr(respbuf, "AUTH")) { /* parse for supported AUTH types */ g_strchomp(respbuf); @@ -520,6 +526,9 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex) /* enclose address in <>'s since some SMTP daemons *require* that */ cmdbuf = g_strdup_printf("MAIL FROM: <%s>\r\n", sender); + + fprintf(stderr, "sending : %s", cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -541,6 +550,9 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex) g_strerror (errno)); return FALSE; } + + fprintf(stderr, "received: %s\n", respbuf); + } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -556,6 +568,9 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex) /* enclose address in <>'s since some SMTP daemons *require* that */ cmdbuf = g_strdup_printf("RCPT TO: <%s>\r\n", recipient); + + fprintf(stderr, "sending : %s", cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -577,6 +592,9 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex) g_strerror (errno)); return FALSE; } + + fprintf(stderr, "received: %s\n", respbuf); + } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -594,6 +612,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * /* enclose address in <>'s since some SMTP daemons *require* that */ cmdbuf = g_strdup("DATA\r\n"); + + fprintf(stderr, "sending : %s", cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -616,13 +637,15 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * g_strerror (errno)); return FALSE; } + + fprintf(stderr, "received: %s\n", respbuf); /* setup stream filtering */ mimefilter = camel_mime_filter_smtp_new(); filtered_stream = camel_stream_filter_new_with_stream(transport->ostream); id = camel_stream_filter_add(filtered_stream, CAMEL_MIME_FILTER(mimefilter)); - if (camel_stream_write_to_stream(transport->ostream, CAMEL_STREAM(filtered_stream)) == -1) { + if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER(message), CAMEL_STREAM(filtered_stream)) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA send timed out: message termination: " "%s: mail not sent", @@ -635,6 +658,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * gtk_object_unref(GTK_OBJECT(filtered_stream)); /* terminate the message body */ + + fprintf(stderr, "sending : \\r\\n.\\r\\n\n"); + if ( camel_stream_write (transport->ostream, "\r\n.\r\n", 5) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA send timed out: message termination: " @@ -654,6 +680,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * g_strerror (errno)); return FALSE; } + + fprintf(stderr, "received: %s\n", respbuf); + } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -667,6 +696,9 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) gchar *cmdbuf, *respbuf = NULL; cmdbuf = g_strdup ("RSET\r\n"); + + fprintf(stderr, "sending : %s", cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -688,6 +720,9 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) g_strerror (errno)); return FALSE; } + + fprintf(stderr, "received: %s\n", respbuf); + } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -701,6 +736,9 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) gchar *cmdbuf, *respbuf = NULL; cmdbuf = g_strdup ("QUIT\r\n"); + + fprintf(stderr, "sending : %s", cmdbuf); + if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf)) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -722,6 +760,9 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) g_strerror (errno)); return FALSE; } + + fprintf(stderr, "received: %s\n", respbuf); + } while ( *(respbuf+3) == '-' ); /* if we got "221-" then loop again */ g_free(respbuf); -- cgit v1.2.3