Moving email receiving code to messages controller