move inbound e-mail parsing guts into an extra, add tests for it