Mailhandler Diagram

OK, I usually like to put this sort of thing in Visio but today I just don’t have time and i need my whiteboard. So i took a pic of it and am posting it here. It may be of some use if you can make out my writing. But this show pretty thoroughly how all the mailhandler stuff went together. If you want to know more about this, send me a message and I’ll clarify.Drupal Mailhandler Diagram

Mailhandler Module

Well, I’m just about done with this. And it was a bit of a chore. But it does work, well at that. Here are some of the point to consider

  • Have a mailbox that is accessible over the proper TCP port. when I tested secure IMAP earlier, it didn’t work because I am sure that my provider’s firewall is blocking 995. Other than that the POP3, IMAP4 stuff is pretty straightforward
  • Make sure that the email address that is sending the email to the POP3/IMAP4 account is registered to one of your user accounts. That is what the “from” authentication is all about. It has to see that the from field is known so it can be seen as an Authenticated User.**
  • Make sure that the “authenticated user” role is permitted to create content for the content type that the feed importer is attached to in the Drupal Permissions part of the user accounts
  • Make sure that the Feeds Importer that you setup is like this next bullet
  • Basic settings

    • Attached to: Static Text – this is the content type that I created for email import. you can and should create your own.
    • Periodic import: as often as possiblethis way it will pull new email from the POP/IMAP account whenever you run cron manually for testing. when you have it right, send a test email to the account, run cron and the new content will be visible when you click Content
    • Import on submission

    Fetcher

    Mailhandler fetcher

    Connects to an IMAP/POP mailbox. – these are all that you need for the Fetcher

    Parser

    Mailhandler IMAP stream parser

    Parses an IMAP stream. – these are all that you need for the Parser

    Processor

    Node processor

    Create and update nodes.

    Mapping for Node processor – this is what I have for Processor, Settings and Mapping. I believe that the Mapping is the important part and i have it below. the real key for me was the Subject source being matched to the Title target. That way the content has the subject listed in a logical place when you see the node in Content.

    Define which elements of a single item of a feed (= Sources) map to which content pieces in Drupal (= Targets). Make sure that at least one definition has a Unique target. A unique target means that a value for a target can only occur once. E. g. only one item with the URL http://example.com/content/1 can exist.

    SOURCE TARGET TARGET CONFIGURATION

    Message ID

    GUID
    Used as unique.
     Remove

    Subject

    Title
    Not used as unique.
     Remove

    Date (date)

    Published date
     Remove

    Body (HTML)

    Body
     Remove
     this makes sense once you work your way through it and see the logic. It is built this way because this way will provide you with the most flexibility later on if you want to get really complicated. It isn’t the easiest thing in Drupal, but it is far from the hardest.

** Since I am receiving email from an outside party from a mailing list, I created a dummy account with that email address.

Mail Handler Update

I believe that I have the Mailhandler module working properly. And, as usual with Drupal, there are a few quirks.

I tried it with my gmail account, which requires TCP port 995 for POP3 or 993 for IMAP4 These are the secure versions of these protocols. But they don’t appear to work properly. At least, I couldn’t get them. But I have my DOCResource.org email provider, Blackmesh.com, and they were able to give me some fast assistance.

I used IMAP, over port 143. I created an address on the qmail admin page, set the password and then went through the very simple process of connecting. Here is a note. When you are connected successfully, you will get a notice seen in the attached image. But when it fails, it should fail quickly and not tell you anything. And that slowed me down because I thought that it was working. So look for the msg below.

The next step is to configure a Feed importer that uses the Mailhandler mod as a “Fetcher”. I have mine setup but I am not sure if it is working yet. Will return soon.

Image

Mail Handler – Module and Prerequisites

I’m working with the Mailhandler module in my sandbox. Of course, there are prereqs. I have to install Feeds. So I installed the Feeds module but I’m only enabling the Feeds submod itself. then, the mailhandler mod and mailhandler IMAP module. So I also have to enable PHP IMAP. Here is the message the you will get when you try to enable the module:

Mailhandler PHP IMAP requires that PHP’s IMAP extension is enabled in order to function properly. (Currently using IMAP Not found).

http://www.php.net/imap

OK, this is easier than it appears, especially in Centos. From the command line type,

yum install php-imap

service httpd restart

So easy. I think that I love Linux. And my whole career I have been a Microsoft guy. 😉

Now you’ll be able to choose the submod. Now, I have it in Sand. Going to make sure nothing is broken then install it in prod.

also installing features

feeds admin ui

strongarm – you only need these mods for the example submod. i’m not going to put it in prod.

I believe that the settings for the mailbox are ok. going to try the rest of this and see what happens.