mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Send singed-only messages
This commit is contained in:
@@ -252,26 +252,10 @@ public class MessageHelper {
|
||||
|
||||
for (final EntityAttachment content : attachments)
|
||||
if (EntityAttachment.PGP_CONTENT.equals(content.encryption)) {
|
||||
final ContentType ct = new ContentType(content.type);
|
||||
final ContentType cts = new ContentType(attachment.type);
|
||||
|
||||
// Build content
|
||||
FileDataSource dsContent = new FileDataSource(content.getFile(context));
|
||||
dsContent.setFileTypeMap(new FileTypeMap() {
|
||||
@Override
|
||||
public String getContentType(File file) {
|
||||
return ct.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType(String filename) {
|
||||
return ct.toString();
|
||||
}
|
||||
});
|
||||
BodyPart bpContent = new MimeBodyPart();
|
||||
bpContent.setDataHandler(new DataHandler(dsContent));
|
||||
BodyPart bpContent = new MimeBodyPart(new FileInputStream(content.getFile(context)));
|
||||
|
||||
// Build signature
|
||||
final ContentType cts = new ContentType(attachment.type);
|
||||
BodyPart bpSignature = new MimeBodyPart();
|
||||
bpSignature.setFileName(attachment.name);
|
||||
FileDataSource dsSignature = new FileDataSource(attachment.getFile(context));
|
||||
@@ -483,6 +467,18 @@ public class MessageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
static void overrideContentTransferEncoding(Multipart mp) throws MessagingException, IOException {
|
||||
for (int i = 0; i < mp.getCount(); i++) {
|
||||
Part part = mp.getBodyPart(i);
|
||||
Object content = part.getContent();
|
||||
if (content instanceof Multipart) {
|
||||
part.setHeader("Content-Transfer-Encoding", "7bit");
|
||||
overrideContentTransferEncoding((Multipart) content);
|
||||
} else
|
||||
part.setHeader("Content-Transfer-Encoding", "base64");
|
||||
}
|
||||
}
|
||||
|
||||
MessageHelper(MimeMessage message) {
|
||||
this.imessage = message;
|
||||
}
|
||||
@@ -1295,7 +1291,7 @@ public class MessageHelper {
|
||||
apart.attachment = new EntityAttachment();
|
||||
apart.attachment.disposition = apart.disposition;
|
||||
apart.attachment.name = apart.filename;
|
||||
apart.attachment.type = ct.getBaseType().toLowerCase(Locale.ROOT);
|
||||
apart.attachment.type = "text/plain";
|
||||
apart.attachment.size = getSize();
|
||||
apart.attachment.encryption = apart.encrypt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user