Mailhandler commands system (2.x)
In Mailhandler 2.x, commands are handled in the Mailhandler Parser in a more extensible way. Recall that the Mailhandler Parsers exists as part of a Feeds Importer, which is also made up of a fetcher (Mailhandler Fetcher) and processor (Node Processor or Comment Processor). In any Feeds Importer, the parser presents 'sources' to the processor (such as the 'from' address of an email) that can be mapped to 'targets' (such as the user ID / author of a node).
The extensibility of traditional parsers is limited, since they can only provide a limited list of mapping sources. However, the Mailhandler Parser uses 'command plugins' to provide mapping sources in a highly extensible and customizable way. It's easiest to think of commands plugins as 'mini-parsers' or 'subparsers', although they don't strictly extend parsers. Each command plugin provides a small number of mapping sources- for instance, the default plugin provides basic sources such as the email body, the headers plugin provides IMAP headers such as the subject line, and the files plugin provides file attachments. Recall that each of these items is provided as a source that MUST be mapped in the processor to corresponding node or comment properties.
In the parser configuration, you can also set a list of available commands that will then appear as mapping sources, and you can set default values for these commands.
So here's an example workflow:
- Enable the Mailhandler Default module, which will create a Mailhandler Nodes importer. Edit that importer, and go to the parser configuration page.
- See how the available commands are 'status' and the default command is 'status: 1'? Now go to the processor configuration and note that 'status' is mapped to 'Published status'. What this all means is that new nodes submitted by email will be published by default, but you can override this default when creating new nodes by email by placing 'status: 0' at the top of emails.
- Finally, note that because you have to manually map sources to targets, you can make up your own custom-named commands. For instance, instead of having the default/available commands be 'status: 1', you could name them 'Published: 1', which is a touch more user-friendly.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion