Title: Sending SMIME messages with sendMail endpoint is broken. · Issue #2544 · microsoftgraph/msgraph-sdk-java · GitHub
Open Graph Title: Sending SMIME messages with sendMail endpoint is broken. · Issue #2544 · microsoftgraph/msgraph-sdk-java
X Title: Sending SMIME messages with sendMail endpoint is broken. · Issue #2544 · microsoftgraph/msgraph-sdk-java
Description: Describe the bug Hello, We are using Microsoft Graph Java SDK to send encrypted SMIME Messages. We are already encrypting the content and provide a full MIME document to endpoint: https://graph.microsoft.com/v1.0/me/sendMail For example ...
Open Graph Description: Describe the bug Hello, We are using Microsoft Graph Java SDK to send encrypted SMIME Messages. We are already encrypting the content and provide a full MIME document to endpoint: https://graph.mic...
X Description: Describe the bug Hello, We are using Microsoft Graph Java SDK to send encrypted SMIME Messages. We are already encrypting the content and provide a full MIME document to endpoint: https://graph.mic...
Opengraph URL: https://github.com/microsoftgraph/msgraph-sdk-java/issues/2544
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sending SMIME messages with sendMail endpoint is broken.","articleBody":"### Describe the bug\n\nHello,\n\nWe are using Microsoft Graph Java SDK to send encrypted SMIME Messages.\nWe are already encrypting the content and provide a full MIME document to endpoint:\nhttps://graph.microsoft.com/v1.0/me/sendMail\n\nFor example our MIME Message looks like this (saved on content variable):\n\n```\nDate: Tue, 10 Feb 2026 11:24:45 +0000 (UTC)\nFrom: HenriettaM@xyz.onmicrosoft.com\nTo: xxx-test@gmx.de\nMessage-ID: \u003c....>\nSubject: Test2\nMIME-Version: 1.0\nContent-Type: application/pkcs7-mime; name=\"smime.p7m\"; smime-type=authEnveloped-data\nContent-Transfer-Encoding: base64\n\nMIAGCyqGSIb3DQEJEAEXoIAwgAIBADGCAdswggHXAgEAMIGPMHcxCzAJBgNVBAYTAkRFMQwwCgYD\n...\n\n```\n\nWe are using the following code snipplet to send the Email:\n\n```\ninitializeGraphClient();\nString encoded = Base64.getEncoder().encodeToString(content.getBytes());\n\nRequestInformation requestInfo = new RequestInformation();\nrequestInfo.httpMethod = HttpMethod.POST;\nrequestInfo.urlTemplate = \"{+baseurl}/users/{+email}/sendMail\";\nrequestInfo.pathParameters = new HashMap\u003c>();\nrequestInfo.pathParameters.put(\"baseurl\", \"https://graph.microsoft.com/v1.0\");\nrequestInfo.pathParameters.put(\"email\", config.getMailbox());\nrequestInfo.headers.put(\"Content-Type\", Set.of(\"text/plain\"));\nrequestInfo.setContentFromScalar(client.getRequestAdapter(), \"text/plain\", encoded);\n\nHashMap\u003cString, ParsableFactory\u003c ? extends Parsable>> errorMapping = new HashMap\u003c>();\nerrorMapping.put(\"4XX\", ODataError::createFromDiscriminatorValue);\nerrorMapping.put(\"5XX\", ODataError::createFromDiscriminatorValue);\n\nclient.getRequestAdapter().sendPrimitive(requestInfo, errorMapping, Void.class);\n```\n\nHowever our SMIME content is converted into an attachment and send as an attachment packed into a multipart/mixed structure by sending the Email.\n\nHere is what we get on the reciever side:\n\n```\nContent-Type: multipart/mixed;\n\tboundary=\"_002_155174533371770722695547_\"\nMIME-Version: 1.0\n\n--_002_155174533371770722695547_\nContent-Type: text/plain; charset=\"us-ascii\"\nContent-Transfer-Encoding: quoted-printable\n\n--_002_155174533371770722695547_\nContent-Type: application/pkcs7-mime; name=\"smime.p7m\"\nContent-Description: smime.p7m\nContent-Disposition: attachment; filename=\"smime.p7m\"; size=4483;\n\tcreation-date=\"Tue, 10 Feb 2026 11:33:38 GMT\";\n\tmodification-date=\"Tue, 10 Feb 2026 11:33:38 GMT\"\nContent-ID: \u003cC06558A1F17AA04CAE95309F8C325E89@namprd19.prod.outlook.com>\nContent-Transfer-Encoding: base64\n\nMIAGCyqGSIb3DQEJEAEXoIAwgAIBADGCAdswggHXAgEAMIGPMHcxCzAJBgNVBAYTAkRFMQwwCgYD\n```\n\nCan you fix sending a SMIME by using this sendMail endpoint or is there any alternative ways for sending SMIME with Graph API?\nWe basically followed the Example 4 in this documentation page:\n\nhttps://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http#example-4-send-a-new-message-using-mime-format\n\n### Expected behavior\n\nSending SMIME messages should work with the sendMail endpoint when Content-Type is provided as text/plain.\n\n### How to reproduce\n\nSee the code snipplet above for example code.\nWe can also provide a full SMIME example content if you want.\n\n### SDK Version\n\n_No response_\n\n### Latest version known to work for scenario above?\n\n_No response_\n\n### Known Workarounds\n\n_No response_\n\n### Debug output\n\n_No response_\n\n### Configuration\n\n_No response_\n\n### Other information\n\n_No response_","author":{"url":"https://github.com/precoder","@type":"Person","name":"precoder"},"datePublished":"2026-02-10T14:04:42Z","url":"https://github.com/microsoftgraph/msgraph-sdk-java/issues/2544"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a9a01bd7-6704-7776-4af0-158cfe06a44c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B830:1F5C2C:9CFE5:D95ED:6AF6BA91 |
| html-safe-nonce | 0cffd13f06a758bfa0b6769fe962382a218b2c402e9b9d23d73b5976d072b251 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODMwOjFGNUMyQzo5Q0ZFNTpEOTVFRDo2QUY2QkE5MSIsInZpc2l0b3JfaWQiOiI0MjQyNzM1ODU2OTEwNTE0ODMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 135657cad85f3a8bb8cfc0533c7999effe692fa4cd6696f291284f1c53558ebc |
| hovercard-subject-tag | issue:3921655198 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoftgraph/msgraph-sdk-java/2544/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b810edc1e81f95db8e08377c62906a1f4df21d4b7cb6ea1b28f68401f470a7ce/microsoftgraph/msgraph-sdk-java/issues/2544 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b810edc1e81f95db8e08377c62906a1f4df21d4b7cb6ea1b28f68401f470a7ce/microsoftgraph/msgraph-sdk-java/issues/2544 |
| og:image:alt | Describe the bug Hello, We are using Microsoft Graph Java SDK to send encrypted SMIME Messages. We are already encrypting the content and provide a full MIME document to endpoint: https://graph.mic... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | precoder |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8dfae1499400ee498ab0f86538d1c034e6c1b4f51c63ecade775c3b0894e3379 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoftgraph/msgraph-sdk-java git https://github.com/microsoftgraph/msgraph-sdk-java.git |
| octolytics-dimension-user_id | 17304259 |
| octolytics-dimension-user_login | microsoftgraph |
| octolytics-dimension-repository_id | 103300409 |
| octolytics-dimension-repository_nwo | microsoftgraph/msgraph-sdk-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 103300409 |
| octolytics-dimension-repository_network_root_nwo | microsoftgraph/msgraph-sdk-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ee168845eb2be91203b179104ac9977fe4ea69a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width