1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-22 06:01:12 +00:00

Improved MDN

This commit is contained in:
M66B 2019-10-02 09:25:18 +02:00
parent c51d2819d5
commit 8c2d9d281b

View file

@ -282,8 +282,18 @@ public class MessageHelper {
plainPart.setContent(plainContent, "text/plain; charset=" + Charset.defaultCharset().name());
report.addBodyPart(plainPart);
String from = null;
if (message.from != null && message.from.length > 0)
from = ((InternetAddress) message.from[0]).getAddress();
StringBuilder sb = new StringBuilder();
sb.append("Reporting-UA: ").append(BuildConfig.APPLICATION_ID).append("; ").append(BuildConfig.VERSION_NAME).append("\r\n");
if (from != null)
sb.append("Original-Recipient: rfc822;").append(from).append("\r\n");
sb.append("Disposition: manual-action/MDN-sent-manually; displayed").append("\r\n");
BodyPart dnsPart = new MimeBodyPart();
dnsPart.setContent("", "message/disposition-notification; name=\"MDNPart2.txt\"");
dnsPart.setContent(sb.toString(), "message/disposition-notification; name=\"MDNPart2.txt\"");
dnsPart.setDisposition(Part.INLINE);
report.addBodyPart(dnsPart);