If I understand correctly from your original post you are trying to search on 4 fields (From, To, Subject and Body) so you will have to modify Hack's code to take that into account.

Basically I suggest you search for "From:" then check whether the data following that meets your search criteria, if it does you then search for "To:" and check whether the data following matches your search criteria, then the same for "Subject:" and finally search the body of the message for whatever you are looking for. If any of the tests fail or any of your search criteria are null then stop / don't start the search.