Fixed deleting message/rfc822 attachments

This commit is contained in:
M66B 2023-08-20 22:10:13 +02:00
parent 7a648035e7
commit 28a35c25f1
1 changed files with 10 additions and 0 deletions

View File

@ -126,6 +126,7 @@ import javax.mail.Store;
import javax.mail.StoreClosedException; import javax.mail.StoreClosedException;
import javax.mail.UIDFolder; import javax.mail.UIDFolder;
import javax.mail.internet.AddressException; import javax.mail.internet.AddressException;
import javax.mail.internet.ContentType;
import javax.mail.internet.InternetAddress; import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
@ -2170,6 +2171,15 @@ class Core {
multipart.removeBodyPart(i); multipart.removeBodyPart(i);
try {
// Can't upload empty message/rfc822
ContentType ct = new ContentType(contentType);
if ("message/rfc822".equalsIgnoreCase(ct.getBaseType()))
contentType = "application/octet-stream";
} catch (Throwable ex) {
Log.w(ex);
}
BodyPart placeholderPart = new MimeBodyPart(); BodyPart placeholderPart = new MimeBodyPart();
placeholderPart.setContent("", contentType); placeholderPart.setContent("", contentType);
placeholderPart.setFileName(fileName); placeholderPart.setFileName(fileName);