Heavy refactor for Email::Receiver

(Includes changes from https://github.com/discourse/discourse/pull/2702)