aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libemail-engine/e-mail-session-utils.c20
-rw-r--r--libemail-engine/mail-ops.c26
2 files changed, 43 insertions, 3 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 524b09d771..cd5dd50c52 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -542,6 +542,26 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
status = camel_service_get_connection_status (context->transport);
if (status != CAMEL_SERVICE_CONNECTED) {
+ EMailSession *session;
+ ESourceRegistry *registry;
+ ESource *source;
+
+ /* Make sure user will be asked for a password, in case he/she cancelled it */
+ session = E_MAIL_SESSION (camel_service_ref_session (context->transport));
+ registry = e_mail_session_get_registry (session);
+ source = e_source_registry_ref_source (registry, camel_service_get_uid (context->transport));
+ g_object_unref (session);
+
+ if (source) {
+ e_source_allow_auth_prompt_sync (source, cancellable, &error);
+ g_object_unref (source);
+
+ if (error) {
+ g_simple_async_result_take_error (simple, error);
+ return;
+ }
+ }
+
did_connect = TRUE;
camel_service_connect_sync (
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index 81ed9a32e6..67fc5a9742 100644
--- a/libemail-engine/mail-ops.c
+++ b/libemail-engine/mail-ops.c
@@ -645,10 +645,30 @@ mail_send_message (struct _send_queue_msg *m,
/* silently ignore */
goto exit;
}
+ if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTED) {
+ EMailSession *session;
+ ESourceRegistry *registry;
+ ESource *source;
+
+ /* Make sure user will be asked for a password, in case he/she cancelled it */
+ session = E_MAIL_SESSION (camel_service_ref_session (service));
+ registry = e_mail_session_get_registry (session);
+ source = e_source_registry_ref_source (registry, camel_service_get_uid (service));
+ g_object_unref (session);
+
+ if (source) {
+ gboolean success;
- if (!camel_service_connect_sync (
- service, cancellable, error))
- goto exit;
+ success = e_source_allow_auth_prompt_sync (source, cancellable, error);
+ g_object_unref (source);
+
+ if (!success)
+ goto exit;
+ }
+
+ if (!camel_service_connect_sync (service, cancellable, error))
+ goto exit;
+ }
/* expand, or remove empty, group addresses */
em_utils_expand_groups (CAMEL_INTERNET_ADDRESS (recipients));