One of the core features that Media Mover has offered from the beginning is harvesting files from an email account and enabling those files to be transcoded as any other file in the Media Mover system. This has provided people the ability to take posts from a variety of different devices (think cell phones here) and get that content directly on their website. In many ways this is a pretty amazing feature- while there are existing email gateways, there aren’t many options for processing the incoming data.
Unfortunately, when Media Mover was first being built, we made the classic programmer move of “go it your own”- we didn’t look for prior art and instead did it our own way. Whether hubris, bad research skills, or dissatisfaction with what existed, this seems to be a common theme for programmers in the open source community- scratch your own itch, if you will. I think there are good sides to this- sometimes, its just what’s needed. On the other….
It didn’t take long for this approach to mail handling to seriously bite back. The code we used couldn’t support SSL mail connections, the code is tangled and not easily extensible. There was no reasonable possibility for adding in support for commands for taxonomy terms, user ids, etc. Suddenly, I realized I had an unworkable solution for our client.
While I’d argue that the core of Media Mover is the other side of this problem- there is a need for a file processing system that can handle a variety processing requirements in Drupal- the mail solution that we implemented failed in two directions. For one, it was hurried and did not anticipate other use cases, for two while it solved a problem that there wasn’t a current solution for, it could have been part of a contribution back to other Drupal projects, making it more viable in the long run.
Fortunately, there are folks like Moshe in the Drupal community who have already built solid mail handling libraries- mailhandler to be precise. While Moshe’s module doesn’t directly integrate with Media Mover, it is built in an abstract way so that I can reuse many of its parts to leverage existing work, and help maintain a common code base for a variety of projects.
So I moved forward and ripped out the custom code from Media Mover and made the Media Mover Email functionality depend on mailhandler. I recycled forms and functions from mailhandler inside of Media Mover. I basically created a presentation layer over the standard mailhandler forms and use it as a wrapper around PHP’s IMAP functions. Now instead of trying to support people on the custom code inside of Media Mover, I can help submit bug reports and patches back to the community of people who are using mailhandler- something that hopefully is a win for everybody involved.
The notion of “scratching your own itch” is a powerful one, and I think its something at the core of the DIY sensibilities of opensource communities. But its not without peril. Having project after project duplicate portions of the same functionality takes away energy from creating solid solutions. Sometimes its necessary to attack the same problem from a different perspective- there is no doubt about it. Flexinode and CCK might well be a good illustration of that. But I think more often than not, those are the exceptional cases, not the rule. What I find attractive in the Drupal community is that there is more of an ethos of a “community itch”- that as programmers, developers, administrators, and users, we are moving together to make a fantastic environment, not just solve our individual issues.
You can checkout the latest and greatest Media Mover email handling code from cvs