HomePhabricator

Add basic support for mail "stamps" to improve client mail routing

Description

Add basic support for mail "stamps" to improve client mail routing

Summary:
Ref T10448. Currently, we use "mail tags" (in SettingsEmail Preferences) to give users some ability to route mail. There are a number of major issues with this:

  • It isn't modular and can't be extended by third-party applications.
  • The UI is a giant mess of 5,000 individual settings.
  • Settings don't map clearly to actual edits.
  • A lot of stuff isn't covered by any setting.

This adds a new system, called "mail stamps", which is similar to "mail tags" but tries to fix all these problems.

I called these "stamps" because: stamps make sense with mail; we can't throw away the old system just yet and need to keep it around for a bit; we don't use this term for anything else; it avoids confusion with project tags.

(Conceptually, imagine these as ink stamps like "RETURN TO SENDER" or "FRAGILE", not actual postage stamps.)

The only real "trick" here is that later versions of this will need to enumerate possible stamps for an object and maybe all possible stamps for all objects in the system. This is why stamp generation is separated into a "template" phase and a "value" phase. In future changes, the "template" phase can be used on its own to generate documentation and typeaheads and let users build rules. This may need some more refinement before it really works since I haven't built any of that yet.

Also adds a preference for getting stamps in the header only (default) or header and body (better for Gmail, which can't route based on headers).

Test Plan:
Fiddled with preference, sent some mail and saw a "STAMPS" setting in the body and an "X-Phabricator-Stamps" header.

Screen Shot 2018-02-04 at 9.38.16 AM.png (1×1 px, 165 KB)

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T10448

Differential Revision: https://secure.phabricator.com/D18991