Index: camel/providers/smtp/ChangeLog
===================================================================
--- camel/providers/smtp/ChangeLog	(revision 8329)
+++ camel/providers/smtp/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-01-04  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #504837
+
+	* camel-smtp-transport.c: (connect_to_server):
+	Do not ignore HELO failed message.
+
 2007-12-23  Jeffrey Stedfast  <fejj@novell.com>
 
 	* camel-smtp-transport.c (smtp_helo): Get rid of some unneccessary
Index: camel/providers/smtp/camel-smtp-transport.c
===================================================================
--- camel/providers/smtp/camel-smtp-transport.c	(revision 8329)
+++ camel/providers/smtp/camel-smtp-transport.c	(working copy)
@@ -308,8 +308,12 @@
 		/* Fall back to HELO */
 		camel_exception_clear (ex);
 		transport->flags &= ~CAMEL_SMTP_TRANSPORT_IS_ESMTP;
-		if (!smtp_helo (transport, ex) && !transport->connected)
+
+		if (!smtp_helo (transport, ex)) {
+			camel_service_disconnect ((CamelService *) transport, TRUE, NULL);
+
 			return FALSE;
+		}
 	}
 
 	/* clear any EHLO/HELO exception and assume that any SMTP errors encountered were non-fatal */
@@ -369,8 +373,11 @@
 
 	/* We are supposed to re-EHLO after a successful STARTTLS to
            re-fetch any supported extensions. */
-	if (!smtp_helo (transport, ex) && !transport->connected)
+	if (!smtp_helo (transport, ex)) {
+		camel_service_disconnect ((CamelService *) transport, TRUE, NULL);
+
 		return FALSE;
+	}
 
 	return TRUE;
 
