From 532930b7107ec66e1dcdd63c7133a311c06a06ff Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 5 Sep 2020 15:52:28 +0200 Subject: [PATCH] Added SMTP DSN --- app/src/main/java/eu/faircode/email/EmailService.java | 5 +++++ app/src/main/java/eu/faircode/email/ServiceSend.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 7f98d8338f..a3857a277d 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -263,6 +263,11 @@ public class EmailService implements AutoCloseable { properties.put("mail.mime.allowutf8", Boolean.toString(value)); } + // https://tools.ietf.org/html/rfc3461 + void setDsnNotify(String what) { + properties.put("mail." + protocol + ".dsn.notify", what); + } + void setListener(StoreListener listener) { this.listener = listener; } diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index 83bd964e82..3e36005f48 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -584,6 +584,12 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar iservice.setUseIp(ident.use_ip, ident.ehlo); iservice.setUnicode(ident.unicode); + if (message.receipt_request != null && message.receipt_request) { + int receipt_type = prefs.getInt("receipt_type", 2); + if (receipt_type == 1 || receipt_type == 2) // Delivery receipt + iservice.setDsnNotify("SUCCESS,FAILURE,DELAY"); + } + // Connect transport db.identity().setIdentityState(ident.id, "connecting"); iservice.connect(ident);