I would like to use mailhandler and listhandler to send/receive messages to my forum/mailing list.

I have installed and configured mailhandler so that it receives emails and creates a new forum entry. The listhandler module does not seem to be functioning correctly though. My setup is as follows.

Mailman list address: list@example.com
Mailhandler mailbox address: mailhandler@example.com

Mailhandler field "E-mail address:" mailhandler@example.com
Mailhandler field "Second E-mail address:" list@example.com
Mailhandler field "POP3 or IMAP Mailbox:" POP3
Mailhanlder field "Mailbox domain:" example.com

I've created a drupal "dummy" account with an email address of list@example.com and have given it a role that has "post comments", "post comments without approval", and "create forum topics" permissions.

Listhandler field "Admin address:" list@example.com

The above field is not mentioned in the installation instructions (which only explains how to configure mailhandler for some reason) that I can see so I have assumed it should contain the address of the dummy account. I have also tried using the email address of the list administrator (which is my own) but with no effect.

Please tell me where I've gone wrong, or clarify the installation instructions.

Comments

tangent’s picture

Examination of the code indicates that the configuration options of the listhandler module are only a factor if the forum comment is posted by an anonymous user or if a mailing list message is received from an address which does not have a drupal account.

Therefore, the reason that my forum posts are not sent to the list is a misconfiguration in mailhandler, a bug in one of the modules, or because the list is refusing the messages.

I have created new forum posts and comments using 2 different drupal accounts. Both of these accounts have email addresses which are subscribed to the mailing list and are able to send messages directly to the list address. As far as I can see I have configured the modules correctly (as detailed above) so I am at a loss. Any suggestions would be appreciated. Otherwise, I am left to debugging these modules.

tangent’s picture

For no reason that I can determine, mailhandler has now stopped working. The problem is not the module but the imap_open function which is used to access a remote mailbox. I don't understand why but it was working before and it suddenly stopped working. When called, it hangs and the page never loads.

I've been researching issues with this function for days now and I've tried every variation of every parameter that is supposed to work around this problem. I've added "/notls", "/norsh", I've tried using pop3 and imap. I've tried every variation of hostname that is possible (ip address, localhost, dns, etc.) and nothing works. I have my host provider looking into the issue right now but I'm not holding my breath.

It is frustrating to read that others have solved the issue simply by adding "/notls" to the mailbox parameter. If anyone has any other suggestions I'd love to hear them. Here's a test script I wrote to test the function.


// I've tried all these hosts
$host = 'xxx.xxx.xxx.xxx';  // my hosts ip address
$host = 'example.com';    // my domain
$host = 'mail.example.com';    // my pop3 hostname
$host = '127.0.0.1';
$host = 'localhost';

// the mail credentials
$user = 'testuser';
$pass = 'testpass';

// connection type
$prot = 'pop3';

if ($prot == 'pop3') {
  // connect with POP3
  $mbox = imap_open('{'.$host.':110/pop3/notls/norsh}INBOX', $user, $pass);
}
else {
  // connect with IMAP
  //    I've tried this without the user param and every other variation
  $mbox = imap_open('{'.$host.':143/notls/norsh/user='.$user.'}INBOX', $user, $pass);
}

// check for errors
$errors = imap_errors();

if ($mbox === false) {
  for ($i=0; $i<count($errors); $i++) {
    echo ($errors[$i] . '<br>');
  }
} else {
  echo 'Connection successful<br>';
  imap_close($mbox);
}

With this script, I get the following output. If I remove the norsh parameter the script just hangs.

Warning: imap_open(): Couldn't open stream {localhost:110/pop3/notls/norsh}INBOX in /home/example/public_html/test.php on line 16
Can't open mailbox {localhost:110/pop3/notls/norsh}INBOX: invalid remote specification
cyberchucktx’s picture

A quick suggestion (may or may not help): run "phpinfo()".

Just do a one-liner and push up to your web server

phpinfo()

That's all there is to it.

What this does is to produce a report of your PHP environment, including the version number(s), modules loaded, and modules INCLUDED in the PHP build.

It MAY be that the IMAP module wasn't included in the build.

Good luck. Post back to this if you have other questions or this doesn't appear to work.

tangent’s picture

I do indeed have IMAP installed.

I have since done a lot of testing with the Drupal modules and with one-off test scripts and have found the IMAP lib to be extremely flaky. I was able to get it working but having even a couple messages in the mailbox (using either POP3 or IMAP) would cause the cron job to timeout and I would have to manually empty the mailbox (and wait some period of time) to get it working again. I had to give up on the module until I have more time to dedicate to making it work.

I would still like to make this work but I have no confidence in the IMAP library for this purpose.

pbull’s picture

I've successfully configured the listhandler module and it works well -- when a new thread is created on the listserve via email it is also posted to the forum. And all replies/comments to that message (both via the mailing list and from the web) are synced between the list and the forum.

The one thing that is not working, is creating a new node in the forum, and having it sent to the list. Has anyone had any luck making this work? Any potential problems?