Some common code to use in Mail Plugins