From 3f0fb8389d306bf45181b192ea1bd6e810b43556 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 15 Aug 2018 16:58:27 +0000 Subject: [PATCH] Set SMTP write timeout --- app/src/main/java/eu/faircode/email/MessageHelper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 731f571e8e..1fcbddfd5b 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -64,25 +64,31 @@ public class MessageHelper { props.put("mail.imaps.ssl.trust", "*"); props.put("mail.imaps.starttls.enable", "false"); + // TODO: make timeouts configurable? props.put("mail.imaps.connectiontimeout", "20000"); props.put("mail.imaps.timeout", "20000"); props.put("mail.imaps.writetimeout", "20000"); // one thread overhead + // https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html#properties props.put("mail.smtps.ssl.checkserveridentity", "true"); props.put("mail.smtps.ssl.trust", "*"); props.put("mail.smtps.starttls.enable", "false"); props.put("mail.smtps.starttls.required", "false"); props.put("mail.smtps.auth", "true"); - props.put("mail.smtps.timeout", "20000"); + props.put("mail.smtps.connectiontimeout", "20000"); + props.put("mail.smtps.writetimeout", "20000"); // one thread overhead + props.put("mail.smtps.timeout", "20000"); props.put("mail.smtp.ssl.checkserveridentity", "true"); props.put("mail.smtp.ssl.trust", "*"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.starttls.required", "true"); props.put("mail.smtp.auth", "true"); - props.put("mail.smtp.timeout", "20000"); + props.put("mail.smtp.connectiontimeout", "20000"); + props.put("mail.smtp.writetimeout", "20000"); // one thread overhead + props.put("mail.smtp.timeout", "20000"); return props; }