mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 07:23:03 +00:00
Improved raw fetch
This commit is contained in:
parent
f03867f115
commit
b3360dde2b
1 changed files with 11 additions and 5 deletions
|
@ -1998,9 +1998,12 @@ public class MessageHelper {
|
||||||
try {
|
try {
|
||||||
// Workaround reformatted headers (Content-Type)
|
// Workaround reformatted headers (Content-Type)
|
||||||
// This will do a BODY.PEEK[] to fetch the headers and message body
|
// This will do a BODY.PEEK[] to fetch the headers and message body
|
||||||
|
MimeMessage amessage = imessage;
|
||||||
|
if (imessage instanceof ReadableMime) {
|
||||||
Properties props = MessageHelper.getSessionProperties(true);
|
Properties props = MessageHelper.getSessionProperties(true);
|
||||||
Session isession = Session.getInstance(props, null);
|
Session isession = Session.getInstance(props, null);
|
||||||
MimeMessage amessage = new MimeMessage(isession, ((ReadableMime) imessage).getMimeStream());
|
amessage = new MimeMessage(isession, ((ReadableMime) imessage).getMimeStream());
|
||||||
|
}
|
||||||
|
|
||||||
// https://datatracker.ietf.org/doc/html/rfc6376/
|
// https://datatracker.ietf.org/doc/html/rfc6376/
|
||||||
String[] headers = amessage.getHeader("DKIM-Signature");
|
String[] headers = amessage.getHeader("DKIM-Signature");
|
||||||
|
@ -4810,8 +4813,11 @@ public class MessageHelper {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (imessage instanceof IMAPMessage) {
|
if (imessage instanceof IMAPMessage) {
|
||||||
if (Boolean.parseBoolean(imessage.getSession().getProperty("fairemail.rawfetch")))
|
if (Boolean.parseBoolean(imessage.getSession().getProperty("fairemail.rawfetch"))) {
|
||||||
throw new MessagingException("Unable to load BODYSTRUCTURE");
|
Properties props = MessageHelper.getSessionProperties(true);
|
||||||
|
Session isession = Session.getInstance(props, null);
|
||||||
|
imessage = new MimeMessage(isession, ((ReadableMime) imessage).getMimeStream());
|
||||||
|
}
|
||||||
|
|
||||||
if (structure)
|
if (structure)
|
||||||
imessage.getContentType(); // force loadBODYSTRUCTURE
|
imessage.getContentType(); // force loadBODYSTRUCTURE
|
||||||
|
|
Loading…
Reference in a new issue