MapiMessage.setBodyContent(htmlBody,BodyContentType.Html); styles not visible for html content

Hi Margarita,

Below is my code
1). I am trying to set mail sensitivity for the mail being sent, but sensitivity is not getting applied to the mail received.
2).And I am trying to send some html code with table in the body content, but table is not getting displayed, I tried including many styles in html code but nothing is not getting displayed in the received mail.

 String htmlBody = "<html><body><table border=1><tr><th><b>Mailbox<b></th><th>Folder Name</th><th>Number of email in folder</th><th>Comment</th></tr><tr><td>Kumar123@gmail.com</td><td>Processing</td><td>10</td><td>Processing Mails</td></tr></table></body></html>";
             final IGraphClient client = getAuoth();
	client.setResource(ResourceType.Users);
	client.setResourceId("test_123@kbca.com");
	
	 InputStream inputStream = null;
	 com.aspose.email.License licenseE = new com.aspose.email.License();
	 inputStream = this.getClass().getResourceAsStream("/Aspose.Total.Java.lic");
     licenseE.setLicense(inputStream);	
	 
	MapiMessage message = new MapiMessage();
	message.setProperty(KnownPropertyList.DISPLAY_TO, "test349@gmail.com");    	    	
	message.setBodyContent(htmlBody,BodyContentType.Html);		
	message.setSubject("Email Processing Report");
	message.setSensitivity(MapiSensitivity.CompanyConfidential);		
	message.save("C:\\Users\\Test\\GraphClient\\Mails\\"+message.getSubject()+".msg");    	
	client.send(message);

I am using below maven dependency. --> version : 22.3

I am attaching the screenshot of the mail received that is being sent from the above code. Please help me in this. You can refer to above conversation for more details.

Mail From Inbox.PNG (7.0 KB)

Hello @jashuvaprasannakumar.kotte,

Thank you for the clarification. Our developers will investigate your case asap.

Hello @jashuvaprasannakumar.kotte,

The issue has been fixed in the Aspose.Email for Java 22.6 release.

Hi @sergey.vivsiuk,

HTML code parsing issue got fixed with Java 22.6 release, thanks for the solution, but mail sensitivity is not getting applied to the mail received. What will be the solution for this issue. Please help me in this issue.

Mail_Sensitivity.PNG (4.1 KB)

@jashuvaprasannakumar.kotte,

Could you check the sensitivity issue with the sendAsMime Graph API method released in Aspose.Email for Java 23.6.
(pay attention to adding the recipient to the message getRecipients().add(…)

MapiMessage message = new MapiMessage();
message.getRecipients().add("test349", "test349@gmail.com", MapiRecipientType.MAPI_TO);
//message.setProperty(KnownPropertyList.DISPLAY_TO, "test349@gmail.com");
message.setBodyContent(htmlBody,BodyContentType.Html);
message.setSubject("Email Processing Report");
message.setSensitivity(MapiSensitivity.CompanyConfidential);
// Send As Mime
client.sendAsMime(message);

Hi @sergey.vivsiuk,

Thank you so much that worked.

@jashuvaprasannakumar.kotte,

Thank you for your interest to our product.

Feel free to write to us if you have any additional query related to Aspose.Email. We’ll be glad to assist you further.

Hi @margarita.samodurova/ @sergey.vivsiuk ,

I am trying to set sensitivity to while sending mail, but the sensitivity label seems like simple one. Can we apply custom information to sensitivity label. I have attached the screenshot, the left side one is sent by Graph Client and right side one is normal mail. Please help me

Mail Sensitivity_Labeling.png (131.8 KB)

Hi @jashuvaprasannakumar.kotte,

Can you clarify how the message that is displayed on the right and visually labeled was sent? I have tried sending messages using Outlook that are marked as confidential, but they are displayed the same way as in the picture on the left, that is, without visual labeling.

Thank you.

Hi @margarita.samodurova,

That is normal mail sent manually applying the sensitivity manually.

Is that possible to add custom label while applying sensitivity?

Thanks.

Hi @jashuvaprasannakumar.kotte,

We tried to manually send a test email via Outlook with the settings as shown in the screenshot setting.PNG (13.1 KB) and we received it as shown in the screenshot test.PNG (17.5 KB).
Can you guide us through the process of sending an email using Outlook so that we can reproduce the result as your normal mail?

Thank you.

Hi @margarita.samodurova,

That is company side configured sensitivity label in the back-end.

My question is can add custom label to sensitivity from GraphClient code.

Thank you.

Hello @jashuvaprasannakumar.kotte,

Maybe server has added some extra property to the email, which is then displayed as a label on the receiving end. Can you save the “normal mail” from Outlook as a msg file, and share it with us to investigate the properties?
Thanks.

Hi @margarita.samodurova,

I am attaching the normal mail from outlook with “Strictly Confidentiality” label got added to it.

Thanks.

Note: As the site not allowing .msg file I have renamed the extension to .docx, please rename the .docx extension to .msg before opening the mail attachment.
Confidentiality Test Mail.docx (74 KB)

@jashuvaprasannakumar.kotte
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILJAVA-35210

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @margarita.samodurova,

Thank you.

@jashuvaprasannakumar.kotte,

We’ll contact you as soon as we have the results of the investigation.

Thanks for your patience.

Hello @jashuvaprasannakumar.kotte,

Could you please check the “Confidentiality Test Mail.msg”?
The message is not marked “Strictly Confidentiality”.
Outlook screen (28.7 KB)

The sendAsMime method of MS GRaph API supports sending all MAPI properties with TNEF format.

Hi @sergey.vivsiuk,

The mail attachment I sent is applied “Strictly Confidentiality” sensitivity only. I am attaching the screenshot please refer. Mail Sensitivity_Labeling_Screenshot.png (84.7 KB)

I am using sendAsMime method of MS Graph API.

Thanks.

Hello @jashuvaprasannakumar.kotte,

Thanks for the clarification.
That labels are not displayed on our side.
As you have already pointed out, company side configured sensitivity label in the back-end.

I have found that Microsoft Graph API does not currently support adding custom sensitivity labels to emails programmatically. Sensitivity labels are typically managed through the Microsoft 365 Security & Compliance Center, and custom sensitivity labels are created and configured by administrators through the Microsoft 365 compliance center or the Security & Compliance Center.

So, unfortunately, the ability to create and manage custom sensitivity labels programmatically through the Microsoft Graph API is not available now.