Send Email through Graph API works w/o attachment, but messages quarantined w/attachment

GraniteStateColin 156 Reputation points
2022-12-27T14:39:40.227+00:00

We're using the send mail feature in Graph API to send email through Exchange. Works fine as long as there's no attachment. However, when we include an attachment, Exchange always quarantines the message, tagged for "malware." It reports "Blocked by organization policy : Antimalware policy block by file type." We have problem sending emails with attachments normally, so I think that proves there is no policy preventing sending messages with attachments. We only have the problem when sending via Graph API.

It doesn't seem to matter what the attachment is -- even just a plain text file attachment is flagged as malware. No other errors. This was true for smaller direct attachments or larger combined files over the 4MB limit through the assembly method (no difference in results that we can tell).

Same effect whether the recipient is external or has a mailbox on the tenant -- works if no attachment, quarantined if it does have an attachment.

I haven't been able to find anything on this yet, but I assume we're missing something so simple and obvious that it doesn't even merit much discussion on the Internet. Perhaps it's just a setting change in Exchange? Or maybe there's a need to set a MIME type as part of the sending process?

What could explain this quarantining problem and any suggestions how to resolve so these messages go through?

Exchange | Exchange Server | Management
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. GraniteStateColin 156 Reputation points
    2023-01-12T18:12:32.9266667+00:00

    In working on this with Microsoft support, we confirmed that this is a problem for enterprise or academic tenants (but not their @outlook.com clients) with their default anti-malware filter. It will block most EPUB files.

    This is because they have a bug/deficiency in that their default blocked files include .JAR files, and many (not all) EPUB files have a .JAR file inside them. An EPUB is effectively a zipped container with a bunch of HTML and related files. These files will often include a .JAR file, which Exchange Online flags by default as malware.

    To fix this, if you want to receive EPUB files at your tenant, be sure to disable the .JAR filter in the Anti-malware filter.

    1 person found this answer helpful.
    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.