Last updated 10 October 2010. Created on 11 December 2005.
Edited by philipnet, highermath, Senpai, AjK. Log in to edit this page.

To allow users to post to and receive email from Drupal forums.

  1. Listhandler works best with an already working mailing list. Please set one up and ensure that it is working. Do note that setting one up is outside the scope of this document.
  2. Listhandler requires Mailhandler to be installed and configured first.
    Both modules can be downloaded from the drupal.org website: http://drupal.org/project/mailhandler and http://drupal.org/project/listhandler If you have not, please download them and extract the contents of the archives into your modules directory.
  3. Within your Drupal website, enable the Mailhandler and Listhandler modules in Administer > Site building > Modules.
    N.B. Please enable Mailhandler first, otherwise Listhandler will fail to enable cleanly.
    In the same section, please ensure that the Forum and Comment modules are also enabled.
  4. Create a forum that you wish to be the repository for your list's messages. Administer > Content management > Forums > Add forum Enter a name, description and set the Parent (leave as "<root>" if unsure) and click on "Submit".
    In the listing, click on the forum name you just created. Make a note of the URL you are sent to. The number at the end of the URL is the 'TID' (Topic IDentification). You will need this later.
  5. Configure a mailbox
    Within your Drupal website go to Administer > Content management > Mailhandler Click on "Add mailbox"
    In the form presented, set the values as indicated:
  • E-mail address
    Email address subscribed to mailing list. This should be the address associated with the mailbox configured below, e.g. my-subscribed-mailbox@example.com
  • Second email address:
    Email address of the mailing list, e.g. my-mailing-list-address@example.com
  • Folder:
    This is the folder for my-subscribed-mailbox@example.com
    Set this to "INBOX" (without the quotes) unless another value is more suitable for your environment.
  • POP3 or IMAP Mailbox:
    This is the protocol used to connect to my-subscribed-mailbox@example.com
    Pick which ever suits your environment. Choose POP3 if unsure.
  • Mailbox domain:
    This is the full name of the email server containing my-subscribed-mailbox@example.com
    Talk to your service provider if you are unsure.
  • Mailbox port:
    Set this to 110 for POP3 or 143 if using IMAP.
    Other port numbers can be used depending on your mailserver configuration.
  • Mailbox username:
    This is the username for the my-subscribed-mailbox@example.com mailbox
  • Mailbox password:
    This is the password for the my-subscribed-mailbox@example.com mailbox
    Please note that this is stored as plain text. Please don't use something sensitive.
  • Extra commands:
    Leave blank unless you run into problems.
    A common value is "/notls", without the quotes.
  • Mime preference:
    Set this to: HTML
  • Security:
    Set this to: Disabled
  • Send error replies:
    Set this to: Disabled
  • From header:
    Set this to a common header always present in emails sent by your mailing list software.
  • Default commands:
    Enter the following two lines:
    tid: 123
    status: 1

    Where 123 is the numeric taxonomy id of the forum you created in step 4.
    The line "status: 1" sets the created node/comment as published

  • Signature separator:
    Set this to "-- ", without the quotes.
    (Yes, there is a space at the end)
  • Delete messages after they are processed?
    Check this option
  • Cron processing:
    Set this to: Enabled
  • Input format:
    (Click on "Import format:" to expand the section)
    Leave the default as "Filtered HTML", unless you have another preference
  • Repeat steps 4 to 5 for each forum/mailing list you wish to configure.
  • Configure permissions
    Within your Drupal website, allow authenticated users to post to forums: Administer > Roles
    Against "authenticated user", click on "edit permissions"
    Under "Forum module", check "create forum topics" and "edit own forum
    topics"
    Click on "Save permissions" (at the bottom of the page)
  • Configure Listhandler
    Within your Drupal website go to Administer > Content management > Listhandler

    In the form presented, set the values as indicated:
    • Admin address:
      This is the email address used by Drupal to send forum posts made by anonymous users to mailing lists. Set this to "anonymous@example.com" or similar and subscribe it to your mailing lists. Set this user to not receive posts or otherwise it might be unsubscribed.
    • Strip title:
      Value(s) to be stripped from email subject lines before posting them as forum
      topics/comments. Make sure to include any mailing list prefixes, like "[my-
      list]". Separate multiple values with commas.
    • Account status:
      When mailing list users post, Listhandler creates an account for them on your Drupal site. You can configure these account to be Blocked or Allowed when created.
      Set as "Allowed" if you want those people to be able to log on to your Drupal site. Set as "Blocked" if you don't.
    • Attachments as link:
      Send attachments as links instead of MIME attachments. It affects only mails generated by forum posts.
      N.B. You will need to have the Upload module enabled and allow users to attach files to forum posts
    • Mailing list and Prefix
      For each mailing list configured, you can set the [prefix] title that the mailing list software appends to the subject line of each email. Set it here to help Listhandler pick the right forum that posts should go to.
      It is also recommended that you set "Strip title" to include mailing list prefix as well.
  • For each configured mailbox, subscribe it to the appropriate mailing list.
  • Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

    Comments

    adixon’s picture

    I've just used this successfully on a 4.6 install, and have three helpful updates, all related to step 2.B.7, the command entries for the mailhandler.

    1. You have to put
    type: forum
    in your commands, or it'll default to creating a blog entry.

    2. A warning about those command entries - you have to leave a space after the : or it won't parse properly.

    3. If you want this to go into a organic group related forum, you can add
    og_group: [<nid>]
    to the command entries (where nid is the nid of your og_group - you can find it by looking at the url for creating nodes inside your group). Don't forget those square brackets, because og_group is required to be an array.

    Other than that, it seems to be working well, thanks.

    adixon’s picture

    If you're using Drupal 4.7 or above, this recipe will likely not work, because the pieces aren't all being maintained. If you use Sympa as your mailing list engine, and are using Drupal 5 or above, then please try out the "Mailing List Groups" module here:

    http://drupal.org/project/og2mlm

    juerg’s picture

    For users of control panels like e.g. CONFIXX the first field in the setup for mailhandler (E-mail Address) can be a little bit confusing. You should enter the name of the mailbox followed by @example.com. Example:

    If you set up a mailbox "web58p7" with the Email-address "mailinglist-example@example.com", you need to fill in "web58p7@example.com" in the field "E-mail address" of mailhandler.

    It might also be that you have to add the command "/notls" in the field "Extra Commands" to make mailhandler working properly.

    Otherwise you are likely to get the following error message: imap_open(): Couldn't open stream ...

    sjtout’s picture

    Just a quick note -- it should be obvious but I spent some time troubleshooting before realizing that because FCKEditor was already installed, I was entering the commands as HTML, so they didn't work. With FCKEditor, I just added the Mailhandler path to the list of exclusions on the FCKEditor configuration page, then returned to the edit mailbox page and re-entered the commands.

    shark’s picture

    The following notes helped me get Mailhandler set up with Google Apps:

    Philw’s picture

    Are email accounts needed for each forum/mailing list? I must have something setup incorrectly because I cannot get this to work completely. I can post to forums and get a notice of it in my email program but I have not been able to get an email to post to the forum. I do receive a notice that the mailing list received my email.

    The way I was reading this tutorial was I need to make an email account for each forum and a mailing list for each forum.

    I am using hostmonster for this project at the moment, and using the basic mailing list script they provide. Should I be using something like dadamail instead?

    Background: I have a site setup with a container and 3 forums in that container. I want to be able to post to these forums via email. Do I need to setup actual email accounts for each forum and then setup a mailing list for each forum as well?

    sjtout’s picture

    When you say 'mailing list' -- do you mean mailhandler mailbox?

    You don't necessarily need a different email account for each forum. I use different directories -- in boxes-- on the same email account. That's nice because when you set up a new one, you can clone an old one and only change a couple of parameters -- the inbox and any commands that are different in the 'Default Commands' box.

    If you can connect to your mailboxes, and you're getting notified that the mailboxes are receiving the email, the issue may be in how mailhandler is classifying the email after it's received. For example, this is the content from my 'Default Commands' box:

    tid: 330
    taxonomy: [Internal Only, Products]
    status: 1
    

    The 'tid' is the term id for the forum, the 'taxonomy' applies a couple of taxonomy terms, and the status publishes the new content.

    Good luck.

    sdemi’s picture

    HowTo document missing required last bullet point in step #5:


    5.

    • Message authentication method:
      Select "Mailhandler Default"
    JBstrikesagain’s picture

    Hi folks, I have this mostly working. I have seen some inconsistencies from this guide and my own behavior though.

    Threads started on email are published in the forum automatically, as i desire. However replies coming from email were always moderated. After I click retrieve from MailHandler it says

    "1 message retrieved for email@example.com.
    Your comment has been queued for moderation by site administrators and will be published after approval."

    for default commands I have tried both

    tid: 1
    status: 1

    and just:

    tid: 1

    Now the funny thing is I got it to automatically publish the comments by *unchecking* "post comments without approval" for the Authenticated User role in the User Permissions.

    But then my authenticated users' comments are moderated..

    honestly this seems like a bug.. unless I'm missing something.

    [root@vission modules]# rpm -q drupal
    drupal-6.19-1.fc13.noarch

    ; Information added by drupal.org packaging script on 2010-06-13
    version = "6.x-1.11"
    core = "6.x"
    project = "mailhandler"
    datestamp = "1276452306"

    thoughts?

    adixon’s picture

    But the code isn't very obscure, so try figuring it out ...

    cor3huis’s picture

    Sure, will do since I need this to work and will do whatever is in my power to get it fixed!

    BTW there is now an issue created for this see http://drupal.org/node/980266#comment-3818924
    Further issue bug discussion should best be posted there.

    Dane Powell’s picture

    This documentation needs to be updated to specify that it's only valid for Mailhandler 6.x-1.x, or to actually work with the newer 6.x-2.x and 7.x-2.x branches.