I want to use mailhandler to read messages from more than one mailbox, and then have node content created automatically for each received message. The created content type will be the same for all messages.
I have set up multiple IMAP mailboxes that mailhandler can read from successfully.
I created multiple feeds importers, configured to use the mailhandler importer and the mailhandler IMAP stream parser and the node processor. I attached these feeds importers to the "mailhandler source" content type, and then created a mailhandler source node for each mailbox.
I ffound that when cron ran it read the first mailbox multiple times (in fact, as many times as there are mailhandler source nodes), and correctly found and processed messages in the mailbox associated with the first mailhandler source node on the first read (but of course the mailbox is empty for subsequent reads). I have confirmed that each mailhandler source is correctly configured the the separate mailboxes.
I then created a new content type ("mailhandler source2"), and attached one of the mailhandler feeds to this new content type. I created a node of this new type and configured it for a mailbox that was not being processed. I unpublished the original mailhandler source node that was being replaced.
When cron next ran, I found that:
1) the original mailbox was checked as many times as before, and
2) the second mailbox was checked, messages retrieved and content nodes created.
It would seem that a different mailhandler content type is required for each mailbox to be checked automatically. Is this the expected behaviour? I would have thought that a single content type with multiple nodes of this type would be the expected configuration.
It would also appear that unpublished mailhandler source nodes are being used to initiate mailbox checks instead of being ignored. If so, it seems like a bug to me.
Thanks.
PS I am using multiple mailboxes because:
1) The emails come from different sources, so may have different information in the body
2) I want to be able to assign different OG groups to messages depending on their mailbox
Comments
Comment #1
danepowell commentedA source content type should only be attached to a single Feeds Importer (I think there's a bug somewhere in the Feeds queue to fix the UI for this).
If all of your importers are the same (you aren't using different node mappings or commands), you can just use a single Importer, associate that with the Mailhandler Source content type, and then create a separate Mailhandler Source node for each mailbox that you want to retrieve from.
Does that make sense? Let me know if it works for you.
Comment #2
jayelless commentedIt makes sense to me, and was the configuration I had originally, which was not working.
However, I decided that perhaps I should start from the beginning, as there had been many configuration variations as I grew my understanding of how mailhandler <=> feeds was supposed to work. It had taken me some time to realise the function of the "glue" content type of "mailhandler source" that linked mailhandler mailboxes with feeds importers. I therefore uninstalled both feeds and mailhandler modules and deleted all traces of them from the database.
After re-installing the required modules (Mailhandler, Mailhandler PHP IMAP, Feeds, Feeds UI), I created two mailboxes, and a feeds importer that generates nodes of the type I require. I then created two mailhandler source nodes, one for each mailbox.
The log now shows that each time cron runs, that both mailboxes are checked, with any waiting messages being proceesed.
I am successfully getting the generated nodes included in the correct OG groups, which had been a problem until I started using the dev release of entityreference.
The only difficulty at present, is that with only a single importer, all generated nodes have the same author. I assume that I will be able to find a suitable source value that I can map to the target that specifies the author (is this "User ID"?).
Thanks for your help.
Comment #3
danepowell commentedYes, you can select an authentication plugin in the Parser configuration. The default plugin just tries to match the sender's email address to a Drupal user account. If you map the User ID to the node author, this should work.
Comment #4
kscheirerSeems like this feature request was resolved? Please reopen if not.
Comment #6
Anil Reddy Vallur commentedCan anyone please help me with this scenario?
I want one feeds importer to import mails and create new node, and other one to update the node. I have two Mailhandler mailboxes separately for each of the functionality. I have configured both the mailboxes and connection seems working fine.
I have created two feeds importers
1. First, I have attached this to Mailhandler source content type. I have done necessary fetcher and parser settings. Node processor update nodes is set to no and in mapping i have not used any unique field.
2. Second, I am using this as stand alone form and not attaching it to any content type. Made necessary fetcher and parser settings. Node processor update is set to yes. In mapping section I'm using node ID (In subject of the mail) as the unique field.
I have created a node of type mailhandler source and attached the first mailhandler mailbox email. Secondly i went to /import, selected the second feed imported and imported nodes.
I have my Linux cron set up to run Drupal cron every 5 minutes.
When i send email to the second mailbox with node ID in subject it is creating new node instead of updating the node.