Mail setting functionality extracted from Spree.