Fixed moving messages without ID and UIDPLUS

This commit is contained in:
M66B
2019-02-17 10:23:17 +00:00
parent 2f9d4c7ebb
commit b0492af20e
2 changed files with 32 additions and 16 deletions

View File

@@ -19,6 +19,8 @@ package eu.faircode.email;
Copyright 2018-2019 by Marcel Bokhorst (M66B)
*/
import java.io.InputStream;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.MimeMessage;
@@ -31,9 +33,21 @@ public class MimeMessageEx extends MimeMessage {
this.msgid = msgid;
}
MimeMessageEx(Session session, InputStream is, String msgid) throws MessagingException {
super(session, is);
this.msgid = msgid;
}
public String getMsgid() throws MessagingException {
if (this.msgid == null)
return super.getMessageID();
else
return this.msgid;
}
@Override
protected void updateMessageID() throws MessagingException {
if (msgid == null)
if (this.msgid == null)
super.updateMessageID();
else {
setHeader("Message-ID", msgid);