Index: camel/providers/smtp/ChangeLog
===================================================================
--- camel/providers/smtp/ChangeLog	(revision 8287)
+++ camel/providers/smtp/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-12-11  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #341579
+
+	* camel-smtp-transport.c: (smtp_set_exception):
+	Try to parse error message returned by server always, even without
+	CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES, and show this text
+	to user, if have any.
+
 2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Merge a bunch of compiler warning fixes and cosmetic
Index: camel/providers/smtp/camel-smtp-transport.c
===================================================================
--- camel/providers/smtp/camel-smtp-transport.c	(revision 8287)
+++ camel/providers/smtp/camel-smtp-transport.c	(working copy)
@@ -824,7 +824,7 @@
 	GString *string;
 	int error;
 
-	if (!respbuf || !(transport->flags & CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES)) {
+	if (!respbuf) {
 	fake_status_code:
 		error = respbuf ? atoi (respbuf) : 0;
 		camel_exception_setv (ex, error == 0 && errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM,
@@ -852,15 +852,30 @@
 			rbuf = buffer;
 		} while (rbuf);
 
-		buffer = smtp_decode_status_code (string->str, string->len);
-		g_string_free (string, TRUE);
-		if (!buffer)
-			goto fake_status_code;
+		if (!(transport->flags & CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES) && string->len) {
+			string->str = g_strstrip (string->str);
+			string->len = strlen (string->str);
 
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				      "%s: %s", message, buffer);
+			if (!string->len) {
+				g_string_free (string, TRUE);
+				goto fake_status_code;
+			}
 
-		g_free (buffer);
+			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+					      "%s: %s", message, string->str);
+
+			g_string_free (string, TRUE);
+		} else {
+			buffer = smtp_decode_status_code (string->str, string->len);
+			g_string_free (string, TRUE);
+			if (!buffer)
+				goto fake_status_code;
+
+			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+					      "%s: %s", message, buffer);
+
+			g_free (buffer);
+		}
 	}
 
 	if (!respbuf) {
