Identifying Signed Mail which have different content-type like "Application/MS-TNEF" rather than "multipart/signed".
Cause :
Signed mails are processed through JavaMail instead of EWS APIs. To identify signed mails, we search for "multipart/signed" in "content-type" header. In this environment, the header value is different ("application/ms-tnef") and the processing through javamail didn't happen.
Solution :
In Signed Mail, an attachment with the following trace is present.
- <t:Attachments>
- <t:FileAttachment>
- <t:AttachmentId Id="AAMkADY0NTU1YTg3LWRiNmEtNGEzMi1hZWJjLWY4MzI5M2JmNTZjNABGAAAAAABHT8y0coDITYAIEWjYJEv8BwBVfPi3CUySQoJijpvVwXjnAAAAAAEMAABVfPi3CUySQoJijpvVwXjnAAJfZL4LAAABEgAQADWeqRERH8JCgwrm07JybDw="/>
- <t:Name>smime.p7m</t:Name>
- <t:ContentType>multipart/signed</t:ContentType>
- <t:Size>44765</t:Size>
- <t:LastModifiedTime>2022-08-08T10:29:46</t:LastModifiedTime>
- <t:IsInline>false</t:IsInline>
- <t:IsContactPhoto>false</t:IsContactPhoto>
- </t:FileAttachment>
- </t:Attachments>
An additonal check of whether the attachment has content-type "multipart/signed" is checked.
Also "smime.p7s" file got skipped.
Before Modification :
- "multipart/signed".equalsIgnoreCase(incomingMail.getAllHeaders().get("content-type"))
After Modification :
- String signed="multipart/signed";
- if(signed.equalsIgnoreCase(incomingMail.getAllHeaders().get("content-type"))){
- flag=true;
- }else if (emailMessage.getHasAttachments() || emailMessage.getAttachments().getItems().size() > 0) {
- AttachmentCollection attachments = emailMessage.getAttachments();
- for (Attachment attachment : attachments) {
- if(attachment.getContentType().equalsIgnoreCase(signed)){
- flag=true;
- }
- }
- }
JAR Compatibility : 13008 ,13001
New to ADSelfService Plus?