1313import android .text .TextUtils ;
1414import android .util .Log ;
1515
16+ import com .flowcrypt .email .api .email .EmailUtil ;
1617import com .flowcrypt .email .api .email .FoldersManager ;
1718import com .flowcrypt .email .api .email .model .AttachmentInfo ;
1819import com .flowcrypt .email .api .email .model .OutgoingMessageInfo ;
@@ -174,8 +175,10 @@ private MimeMessage createMimeMessage(Session session, Context context, File pgp
174175 MimeMultipart mimeMultipart = (MimeMultipart ) mimeMessage .getContent ();
175176
176177 for (AttachmentInfo attachmentInfo : outgoingMessageInfo .getAttachmentInfoArrayList ()) {
177- mimeMultipart .addBodyPart (generateBodyPartWithAttachment (context , pgpCacheDirectory ,
178- js , pubKeys , attachmentInfo ));
178+ MimeBodyPart bodyPart = generateBodyPartWithAttachment (context , pgpCacheDirectory ,
179+ js , pubKeys , attachmentInfo );
180+ bodyPart .setContentID (EmailUtil .generateContentId ());
181+ mimeMultipart .addBodyPart (bodyPart );
179182 }
180183
181184 mimeMessage .setContent (mimeMultipart );
@@ -193,15 +196,15 @@ private MimeMessage createMimeMessage(Session session, Context context, File pgp
193196 * @param js The {@link Js} tools.
194197 * @param pubKeys The public keys which will be used for generate an encrypted attachments.
195198 * @param attachmentInfo The {@link AttachmentInfo} object, which contains general information about attachment.
196- * @return Generated {@link BodyPart } with an attachment.
199+ * @return Generated {@link MimeBodyPart } with an attachment.
197200 * @throws IOException
198201 * @throws MessagingException
199202 */
200203 @ NonNull
201- private BodyPart generateBodyPartWithAttachment (Context context , File pgpCacheDirectory , Js js ,
202- String [] pubKeys , AttachmentInfo attachmentInfo )
204+ private MimeBodyPart generateBodyPartWithAttachment (Context context , File pgpCacheDirectory , Js js ,
205+ String [] pubKeys , AttachmentInfo attachmentInfo )
203206 throws IOException , MessagingException {
204- BodyPart attachmentsBodyPart = new MimeBodyPart ();
207+ MimeBodyPart attachmentsBodyPart = new MimeBodyPart ();
205208 switch (outgoingMessageInfo .getMessageEncryptionType ()) {
206209 case ENCRYPTED :
207210 InputStream inputStream =
0 commit comments