diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index c735fd9f5d..42b6f83f4f 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -372,6 +372,7 @@ public class EntityRule { reply.from = new InternetAddress[]{new InternetAddress(identity.email, identity.name)}; if (cc) reply.cc = message.cc; + reply.unsubscribe = "mailto:" + identity.email; reply.subject = context.getString(R.string.title_subject_reply, message.subject == null ? "" : message.subject); reply.received = new Date().getTime(); diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 8217ee445a..fd59da1e3e 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -120,6 +120,12 @@ public class MessageHelper { DB db = DB.getInstance(context); MimeMessageEx imessage = new MimeMessageEx(isession, message.msgid); + // Flags + imessage.setFlag(Flags.Flag.SEEN, message.seen); + imessage.setFlag(Flags.Flag.FLAGGED, message.flagged); + imessage.setFlag(Flags.Flag.ANSWERED, message.answered); + + // Priority if (EntityMessage.PRIORITIY_LOW.equals(message.priority)) { // Low imessage.addHeader("Importance", "Low"); @@ -134,17 +140,14 @@ public class MessageHelper { imessage.addHeader("X-MSMail-Priority", "High"); } + // References if (message.references != null) imessage.addHeader("References", message.references); if (message.inreplyto != null) imessage.addHeader("In-Reply-To", message.inreplyto); - imessage.addHeader("X-Correlation-ID", message.msgid); - imessage.setFlag(Flags.Flag.SEEN, message.seen); - imessage.setFlag(Flags.Flag.FLAGGED, message.flagged); - imessage.setFlag(Flags.Flag.ANSWERED, message.answered); - + // Addresses if (message.from != null && message.from.length > 0) { String email = ((InternetAddress) message.from[0]).getAddress(); String name = ((InternetAddress) message.from[0]).getPersonal(); @@ -196,6 +199,10 @@ public class MessageHelper { } } + // Auto answer + if (message.unsubscribe != null) + imessage.addHeader("List-Unsubscribe", "<" + message.unsubscribe + ">"); + MailDateFormat mdf = new MailDateFormat(); mdf.setTimeZone(TimeZone.getTimeZone("UTC")); imessage.setHeader("Date", mdf.format(new Date()));