Ensure all headers

pull/184/head
M66B 4 years ago
parent 07a169e3d3
commit 35de6bbd18

@ -818,7 +818,7 @@ public class MessageHelper {
} }
String getMessageID() throws MessagingException { String getMessageID() throws MessagingException {
ensureMessage(false); ensureMessage(false, false);
// Outlook outbox -> sent // Outlook outbox -> sent
String header = imessage.getHeader(HEADER_CORRELATION_ID, null); String header = imessage.getHeader(HEADER_CORRELATION_ID, null);
@ -2233,6 +2233,10 @@ public class MessageHelper {
} }
private void ensureMessage(boolean body) throws MessagingException { private void ensureMessage(boolean body) throws MessagingException {
ensureMessage(body, true);
}
private void ensureMessage(boolean body, boolean all) throws MessagingException {
if (body ? ensuredBody : ensuredEnvelope) if (body ? ensuredBody : ensuredEnvelope)
return; return;
@ -2241,7 +2245,7 @@ public class MessageHelper {
else else
ensuredEnvelope = true; ensuredEnvelope = true;
Log.i("Ensure body=" + body); Log.i("Ensure body=" + body + " all=" + all);
try { try {
if (imessage instanceof IMAPMessage) { if (imessage instanceof IMAPMessage) {
@ -2270,8 +2274,13 @@ public class MessageHelper {
Log.w("Protocol missing content-type=" + contentType); Log.w("Protocol missing content-type=" + contentType);
throw new MessagingException("Failed to load IMAP envelope"); throw new MessagingException("Failed to load IMAP envelope");
} }
} else } else {
imessage.getMessageID(); // force loadEnvelope // force loadEnvelope
if (all)
imessage.getAllHeaders();
else
imessage.getMessageID();
}
} }
} catch (MessagingException ex) { } catch (MessagingException ex) {
// https://javaee.github.io/javamail/FAQ#imapserverbug // https://javaee.github.io/javamail/FAQ#imapserverbug

Loading…
Cancel
Save