Graph Api SendMail changes content-type to multipart/mixed
I am attempting to send the following MIME message using the graph API. The attachment in this example is just a zip file containing a small txt-file. I use the same methods described in these docs: https://learn.microsoft.com/en-us/graph/outlook-send-mime-message
For my use case the content-type is required by the recipient, but when they receive it, the content-type has been changed to multipart/mixed.
It looks like office365 inserts an empty text/plain next to it, making the email multipart/mixed. The mail server we are currently using, does not do this.
Is there a way to prevent this?
This applies to other content-types as well, not just application/zip.
From: ******@test.onmicrosoft.com
Date: Wed, 22 Nov 2023 14:32:26 +0100
Subject: TestMime
Message-Id: 123123
To: ******@test.com
MIME-Version: 1.0
Content-Type: application/zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=test.zip
UEsDBAoAAAAAAOhye1cAAAAAAAAAAAAAAAAIAAAAdGVzdC50eHRQSwECPwAKAAAAAADocntXAAAAAAAAAAAAAAAACAAkAAAAAAAAACAAAAAAAAAAdGVzdC50eHQKACAAAAAAAAEAGADeW0TgNCHaAQAAAAAAAAAAAAAAAAAAAABQSwUGAAAAAAEAAQBaAAAAJgAAAAAA
Here you can see an example of the email that is received. And as you can see it adds unnecessary text/plain content, making the whole email multipart/mixed, instead of just application/zip.
...
Content-Type: multipart/mixed; boundary="_002_P0Q..._"
MIME-Version: 1.0
X-OriginatorOrg: test.onmicrosoft.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: ....PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: GUID
X-MS-Exchange-CrossTenant-originalarrivaltime: Wed, 22 Nov 2023 14:32:26 +0100
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: GUID
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: X
X-MS-Exchange-Transport-CrossTenantHeadersStamped: X
--_002_P0Q..._
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
--_002_P0Q..._
Content-Type: application/zip; name="test.zip"
Content-Description: test.zip
Content-Disposition: attachment; filename="test.zip"; size=8694; creation-date="MWed, 22 Nov 2023 14:32:26 +0100"; modification-date="Wed, 22 Nov 2023 14:32:26 +0100"
Content-ID: X
Content-Transfer-Encoding: base64
--_002_P0Q..._--