Using SMIME in MS Graph

Kai Stredder ■ DEM 21 Reputation points
2022-07-29T13:10:59.157+00:00

Hi!

I'm trying to send signed aswell as decrypted E-Mails via MS Graph.

Creating and sending a normal Message is no Problem.
Using S/MIME is mentioned in the Graph API:

But how to add a certificate or use S/MIME can't be found.
I've created a signed mime object via openssl and sent this, but the used cert was not added.

Need help please!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,891 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Radler65 1 Reputation point
    2022-09-16T10:55:46.997+00:00

    You can use SimplaJavaMail: use EmailPopulationBuilder and EMailBuilder to encode subject, body and attachments with your certificate. Than, with EMailConverter you get a MimeMessage. Get a ByteStream out of it, and this one you can send , base64-encoded, with the sendMail-endpoint of the GraphApi.

    Unfortunately this only works for attachment-Size < 3MB.

    With attachments >= 3MB you have to follow the graph-api doc., see https://learn.microsoft.com/de-de/graph/outlook-large-attachments?tabs=http and https://learn.microsoft.com/de-de/graph/sdks/large-file-upload?tabs=java.

    Its unclear how to combine these two approaches.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.