CRM-11958: New hook implementation for altering outgoing mail configuration

Partial backport: does not include constants and unit tests