corrects minimal_imap method
replaced custom exceptions with built-in python exceptions