If the messaging system follows RFC3834
https://datatracker.ietf.org/doc/html/rfc3834
Automatic responses SHOULD NOT be issued in response to any
message which contains an Auto-Submitted header field (see below),
where that field has any value other than "no".
As an example, in Exchange Online, the following is the header of an OOF:
Auto-Submitted: auto-generated
So look for that header and handle based on that.