aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/smtp
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/smtp')
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index d0b257cd6b..7807e87593 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -391,9 +391,6 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
#endif /* HAVE_SSL */
}
-#define EXCEPTION_RETRY(ex) (camel_exception_get_id (ex) != CAMEL_EXCEPTION_USER_CANCEL && \
- camel_exception_get_id (ex) != CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
-
static gboolean
connect_to_server_wrapper (CamelService *service, CamelException *ex)
{
@@ -401,12 +398,12 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
CamelSmtpTransport *transport = (CamelSmtpTransport *) service;
if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS) {
- /* First try STARTTLS */
- if (!connect_to_server (service, TRUE, ex)) {
- if (!(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS) && EXCEPTION_RETRY (ex)) {
- /* STARTTLS is unavailable - okay, now try port 465 */
+ /* First try connecting to the SSL port */
+ if (!connect_to_server (service, FALSE, ex)) {
+ if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE) {
+ /* Seems the SSL port is unavailable, lets try STARTTLS */
camel_exception_clear (ex);
- return connect_to_server (service, FALSE, ex);
+ return connect_to_server (service, TRUE, ex);
} else {
return FALSE;
}