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.
Comments
How to add default commands
How to add default commands for taxonomy??
It never maps a texonomy term mapped via command system to the newly created nodes if they are created via Cron automatically. The default command for status is 1. But how to set default command for taxonomy terms??
2.x Default Commands Problem
I no longer have a "Default Commands" in the Mailhandler Source node. My problem is getting a forum post to a particular forum. I do not see a "tid" or a "taxonomy" command in the Mapping page on the Importer. Source commands can be added by putting them into the IMAP Stream Processor. There is a default command already on status. Not clear whether the IMAP settings are the appropriate place for creating new default commands, and not clear on whether the default command should have the entire key:value stream or just the key? I have tried to sort this out through the various instructions, but no success thus far. Mainhandler is creating a forum node, just without posting to a particular forum. Trying not to have to do this manually for every post.
Default commands moved in the new version
I ran into this as well and got the answer only in the INSTALL file for MailHandler 6.x-2.9. Default commands have moved to "Available commands" in the Feed Importer. This is under, for example "Settings for Mailhandler IMAP stream parser" on the Feed.