Open the message. Does it have attachments? Yes: Inspect each attachment is it one of the allowed types? Yes: leave attachment intact No: Strip the attachment replace it with a note to the end user that it has been stripped and jailed. No: send message on without being molested.