How can I detect attachments using Mailgun routing filters?

I need help setting up a Mailgun route filter to identify if an incoming email includes an attachment. Although the documentation mentions that filtering by MIME headers is possible, none of my header-matching attempts have been effective. I’ve experimented with different header tests, but the filter still doesn’t trigger when an attachment is present. Does anyone have alternative suggestions or adjustments that might work?

// Sample code to illustrate header validation
validate_header("MIME-Type", "^multipart")
validate_header("fileCount", "\d+")
validate_header("fileOne", ".+")

I recently encountered a similar issue where determining attachment presence using Mailgun routing filters turned out to be more complicated than expected. From my experience, the direct approach of matching MIME headers often falls short because attachments may not trigger the expected patterns consistently. Instead, I ended up processing the email content via a custom webhook that inspected the MIME structure for content-disposition indicators. Although this method involves extra backend parsing, it proved more flexible since it allowed me to reliably identify attachment boundaries without relying solely on header matching filters.