mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-01 18:41:20 +01:00
Workaround double encoded subjects
This commit is contained in:
@@ -54,6 +54,7 @@ import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeBodyPart;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
import javax.mail.internet.MimeUtility;
|
||||
import javax.mail.internet.ParseException;
|
||||
|
||||
public class MessageHelper {
|
||||
@@ -435,6 +436,19 @@ public class MessageHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
String getSubject() throws MessagingException, UnsupportedEncodingException {
|
||||
String subject = imessage.getSubject();
|
||||
if (subject != null && subject.indexOf("=?") >= 0) {
|
||||
String prev;
|
||||
do {
|
||||
prev = subject;
|
||||
subject = MimeUtility.decodeText(subject);
|
||||
}
|
||||
while (!subject.equals(prev));
|
||||
}
|
||||
return subject;
|
||||
}
|
||||
|
||||
Integer getSize() throws MessagingException {
|
||||
int size = imessage.getSize();
|
||||
return (size < 0 ? null : size);
|
||||
|
||||
Reference in New Issue
Block a user