HowTo: Integrate mailing lists with forums using listhandler and mailhandler
(To allow users to post to, and receive email from Drupal forums)
- Preset your email environment
- Go to your web hosting account’s administrative page and create an email account (mailbox) that will be dedicated to receiving posts to your forum. Give it a non-obvious name, to prevent spammers from sending posts to your forum by addressing this mailbox directly. (Your users will not have to know, nor should they know, the name of this mailbox.)
- While still in your hosting account, create a mailing list that will be dedicated to your forum. This is typically done through Mailman or whatever mailing list manager comes with your account. Give this mailing list an easy-to-remember name, since this is the address to which your users will email their forum posts.
- Go to the admin page for the list you created in step 1.B, and subscribe the email address of the mailbox you set up in step 1.A to your list. Make this subscription non-public so no one will know it’s there but you (in Mailman this is done using the "hide" option for that subscription). Also subscribe your own email address to the list (public or private, depending on whether you are going to allow people to see who is subscribed to your list). You should also add a "subject prefix" (e.g. "[CS Community]") to your list, so that your users will know the origin of the emails they receive. You may also wish to add any initial regular member email addresses to the list at this point, since subscription to the list will not be done automatically when a user is added in Drupal (this is one of the big headaches/maintenance chores of this approach, but I am told that the EZMLM module provides this capability if you use it instead of Mailman or another list manager). Also see the note in step 2.C.3, below.
- Set up your Drupal system
- If you have not already done so, create your forum using administer|forums. Go to "forums" on the main sidebar menu, click on the name of the forum, and note the "tid" number at the end of the contents of your browser’s address bar (e.g. http://www.example.com/myforum/6 – "6" is this forum’s tid).
- Go to administer|mailhandler|add mailbox, and complete the fields as follows:
- E-mail address and Second E-mail address: enter the address of the list you set up in step 1.B (not the address of the mailbox you set up in step 1.A).
- Complete either the Folder field or the mailbox fields to point Mailhandler to the mailbox you set up in step 1.A.
- Mime preference: as desired
- Security: disabled (typically)
- Send error replies: disabled
- From header: leave blank
- Default commands: "tid: n", where "n" is the tid of the forum you set up in step 2.A
- Signature separator: as desired (can be blank)
- Delete messages after they are processed?: selected
- Cron processing: disabled while setting up, enabled thereafter (step 3.H)
- Input format: as desired
- Go to administer|listhandler and complete the fields as follows:
- Admin address: enter a unique email address, e.g. mailto:list-admin@example.com
- Strip title: anything you don’t want to see added to the title or subject of your posts. Usually includes the "subject prefix" you entered in step 1.C.
- Account status: "blocked" if you don’t want anonymous posters to your list (or to the mailbox you set up in step 1.A if someone figures out what it is) to be granted any privileges on your site. "active" if you run a wide-open site to which anyone can subscribe and post. (Note: Listhandler will automatically add an anonymous poster to your site as a user. If you don’t want to allow anonymous users to post to your list, thereby preventing them from automatically being made members of your site, be sure to disallow anonymous posts to your list in step 1.C.)
- Mailing List: You will see the mailhandler you set up in step 2.B in this list. Enter the same "subject prefix" you entered in step 1.C.
- Testing and completing your setup
- Open your email client and send a message to the address of the list you set up in step 1.B (not the mailbox you set up in step 1.A).
- The list manager you set up in step 1.B should send a copy of this message to the mailbox you set up in step 1.A, and also a copy to you, assuming you have subscribed both the mailbox (required) and yourself (optional, but recommended) to the list in step 1.C.
- In CS/Drupal, go to administer|mailhandler, and click "retrieve" for the mailhandler mailbox you set up in step 2.B. You should see a message saying "n" messages have been retrieved for the mailbox.
- Go to the forum that corresponds to this mailing list. You should see your post there.
- Go back to the inbox of your email client and reply to the copy of your own post that the list manager has sent you. Wait for your reply to appear in your inbox, indicating your list manager has processed it and sent it to the mailbox you set up in step 1.A.
- Repeat step 3.C-D, and verify that your reply has been properly "threaded" (attached as a comment to the original post).
- Go to your site, click "forums", and use "post new forum topic" to post a message to the forum at the site (i.e. not via email). Repeat step 3.C. Your post should be sent to your list, and you should receive a copy of it in your email client’s inbox.
- Once you have verified that things are working properly, go to administer|mailhandler, click "edit" for the mailbox, and set Cron processing to "enabled". Mailhandler and Listhandler will now process incoming and outgoing posts every time cron.php is run.
Congratulations! You have now linked a mailing list with your forum using Mailhandler and Listhander. If you have multiple forums, repeat the above steps using a separate mailbox (step 1.A) and mailing list (step 1.B) for each additional forum. (This will add to your maintenance tasks, though, so keep your site to as few forums as possible.)

More info about the 'commands'
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: forumin 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.
Alternative for Drupal 5+ Sympa
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
E-Mail Address in Mailhandler
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 ...