Okay... so I'm a little bit stumped again. I am trying to set up a system that pulls from multiple mailboxes and posts the items each mailbox into a separate forum, as defined by taxonomy. I was thinking that what I needed to do was set up a different parser for each mailbox and I would just set the taxonomy to default to the correct term. However, there is no way to set which mailbox each importer should pull from outside of using the import form. Obviously we want this system to be able to pull and process emails on a regular basis without human intervention. So, now I have no idea how to set up the system that I want to.

How does it currently work for imports done on cron? Does it pull every mailbox for every importer that matches up?

Thanks in advance for any assistance!

Sean

Comments

pyrello’s picture

Status: Active » Closed (duplicate)
pyrello’s picture

Status: Closed (duplicate) » Active

Okay, I lied, this is not exactly a duplicate of that other issue. I followed the instructions there: creating a Mailhandler Source content type, creating 8 unique mailboxes, 8 unique feed importers that reference the content type instead of the standalone form, and finally 8 Mailhandler Source nodes that each reference one of the 8 mailboxes. As far as I can tell, the problem is that there is no specific connection between each node that I created and the feed importer that I want it to match up with. So when I run cron, all my mailboxes get processed through only one feed importer and all end up in the same forum.

danepowell’s picture

If you have 8 different importers, you need 8 matching content types, with one node of each type. It sounds like it might be useful to be able to specify default comments for each mailbox, in addition to each importer- this would allow you to set the taxonomy term for each mailbox, and only have one importer. Alternatively, once #634462: Attach multiple importers to one content type (in D6) lands, you can use your current setup- 1 content type, and either 1 node with all 8 importers on it, or 8 nodes with a different importer selected for each.

Additionally, maybe the documentation needs to clarify that if you are importing from cron, every importer should have a matching content type.

cvining’s picture

I gotta say it seems to work, but it is a bit confusing (to me) to get it all setup and running.

'All' I wanted to do was to have a mail-to-forum gateway, to archive two mailing lists I run. I'll worry about a forum-to-mail gateway later. I should think this was a fairly common need, but maybe I'm wrong about that.

There is a Handbook entry "Setting up an email-driven workflow with attachments (2.x)" which might work

http://drupal.org/node/1045918

But 1) not all those projects are ready for for D7, 2) it requires Drush, 3) Just plain Wow. Now, I'm hardly Drupal squeamish, or even PHP squeamish, but this is pretty intimidating. Not to mention time consuming and prone to error.

Sounds to me like a nice, do-able project for a module, albeit one with lots of dependencies: enter details for a pop mailbox, and the forum (well, content type and taxonomy maybe?) you want the mails to end up in, and the module does the rest of the setup work. Until then, here's what I've done.

Draft Simplified HowTo for a mail-to-forum Gateway:

- Create Mailhandler for your mailbox
- Create Feed Importer to create a Forum posting from a Mailhandler
- Create a Content type for the intended Gatway
- Associate that Content Type with THAT Feed
- Create ONE node of that THAT content type
- Test that it works with cron.

It does seem like a lot of odd overhead. Each gateway requires a unique mailbox, unique Feed importer, unique Content Type and ONE node posting of that content type.

And what happens if I create more than one posting of my gateway's content type? Sheesh!

Now, I appreciate that the architecture for each of these components has been thought through and discussed. Mailhandler, Feeds, Content Types, Nodes. These are each complex, multi-purpose components. And there are reasons for all of this, I'm quite sure. Good ones. But that's a lots of component, lots of modules, lots of dependencies. Which means, lots of ways to break. And lord help me when D8 comes out and just ONE component in the chain isn't available.

Back in the day, wrote a single script in PHP to POP3 a mailbox and make a web posting all by my lonesome. Sometimes Drupal blows me away with elegance and power. Other times it just seems so Rube Goldberg.

Anyway, I hope I don't sound like I'm just ranting. I really do appreciate all the effort and thought that's going into this. I suppose I'm putting in a feature request: a simplified, more automated workflow for creating a mail-to-forum gateway. And once that's working, I'll be back to talk about a forum-to-mail gateway!

Thanks!

-- Cronin

PS - I've just got this all setup and apparently working. Now I'll wait a couple days, just to see the cron job is working as expected. At that point I declare victory!

danepowell’s picture

Title: How to specify which mailbox an importer uses on cron vs import form » How to specify which mailbox an importer uses on cron vs import form?
Version: 6.x-2.0-beta1 » 6.x-2.x-dev
Component: Code » User interface
danepowell’s picture

Sorry it's taken so long to get back to you on this, I've been focusing on getting a stable 2.x release out. I understand your frustration, and I'd like to work with you to figure out a more sensible solution - I understand that with greater power and flexibility also comes greater complexity, and if you look through the commit log you'll notice I'm trying to improve usability and reduce the overhead associated with that complexity. What about one or more of the following solutions?

  • Add 'default commands' to source nodes: Thus, you could have eight Mailhandler Mailboxes for eight different forums, one Mailhandler Source content type, eight Mailhandler Source nodes, and one Feeds Importer. It's not 100% streamlined, but it's better than your current situation
  • Add a custom commands plugin, and use a 'catch-all' email address: The way I envision this working is that you could have separate email addresses for separate forums (forum1@example.com, forum2@example.com...) that each forward to a catch-all address (forumhandler@example.com). You create one Mailbox, one Source content type, one Source node, and one Importer. In the importer, a commands plugin looks at the original 'to' address and maps this to a taxonomy term or other type of command that determines where the node gets posted.
danepowell’s picture

Title: How to specify which mailbox an importer uses on cron vs import form? » Moved default commands from parser settings to source nodes
Version: 6.x-2.x-dev » 7.x-2.x-dev
Component: User interface » Mailhandler
Category: support » task

I've been thinking about this, and what makes the most sense to me is to move the default commands configuration from the parser settings to the source node form. I think this makes sense because, as this issue points out, there are times when you want to specify default commands per mailbox, and also per importer. The source node form is the intersection of these two, so it seems like the ideal place to configure these commands.

pyrello’s picture

@Dane Powell, I would agree with that sentiment. It has been a little bit since I was working on this issue, but I do remember that the complexity of having to create so many content types made it take a long time for me to figure out how to do it. It also just felt wrong, if that makes sense. +1

danepowell’s picture

Title: Moved default commands from parser settings to source nodes » Move default commands from parser settings to source nodes
Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Active » Patch (to be ported)

Okay, I fixed this in 7.x-2.x:
http://drupalcode.org/project/mailhandler.git/commit/8bccec8

Can you please test this ASAP (grab from Git, or the dev release that rolls tonight) and let me know if it works for you?

I'd like to roll 7.x-2.5 tomorrow or Monday, but this is a pretty major change so I'd like to get more people testing it first.

danepowell’s picture

Status: Patch (to be ported) » Fixed
pyrello’s picture

Sorry, just saw this. I'll try to get a test site set up and let you know if I find any issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rsbecker’s picture

I just upgraded to 6.x-2.5 and the update did not move the default commands from the feed parser to the source node form. I had to go back and do that manually for each of my og groups and the common collector for comments.

danepowell’s picture

@rsbecker - just to check, did each group have a 'source' node, where the importer was attached to the source node type? If so, please open a bug report.

Sorry if it gave you trouble - it worked fine in testing, so we'll have to figure out what about your setup caused it to fail.