How to filter undeliverable emails?

Dear Gurus,

How can I filter undeliverable emails?

I have a group of users that send emails to internet addresses. But some responses are “Undeliverable emails”, and all these emails come to a central mail in mailbox. I would need to filter these undeliverable emails and forward these messages to another database.

The question is how can I filter Undeliverable emails?

Can I use: “SMTPDSNDeliveryStatus”

if (doc.hasItem(“SMTPDSNDeliveryStatus”)) {

//doc is an Undeliverable email

} else {

//doc is not an Undeliverable email

}

Is there any other way of filtering Undeliverable emails?

Thanks!