You are not going to be able to do the searches without saving the attachments to a temporary location and opening them in suitable applications. This is going to impose a large overhead on the sending of any message that has attachments, and I have to wonder what the point is? Couldn't you check the content of the attachments before you attach them?