Duplicate comments from web but not Mailman
| Project: | Listhandler |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
We have a Drupal 6 + Mailman system running on a Fedora LAMP server with Postfix and Dovecot. It is working about 95% but there is an annoying behavior remaining that I have not been able to resolve thus far.
If a new forum post is submitted, it is immediately posted to the site and sent off to the mailing list address.
At the cron cycle the copy of the message from the mailing list is processed twice by mailman.
The first time it is not added to the forum as a comment by listhandler_mailhandler because $node->tid is set.
The second time, and I don't know why it goes through again, $node->tid evaluates to false (not set or 0) and the unwanted comment is posted.
In other issue threads ([118564], [275873]) there is a recommendation to change the mailman account used by mailhandler for the list to "nomail" which does prevent the double messages. However, it has the unwanted side effect of preventing email posts and replies from being sent to mailhandler and therefore the forum itself.
The messages sent through mailman do have the message-id header tag and it seems to have reasonable values.
I note that $node->sentbylisthandler is not set on either pass.
What exactly is the flag or value which must be set to let listhandler know that the message was posted directly in the forum so it does not get posted again?
Or, should the messages (and comments) be posted directly or should they be sent to the mailman list and processed at the cron cycle by mailhandler?
Some really specific and successful instructions on how to get forums + mailhandler + listhandler + mailman working together would be welcome. I have looked at a few (online and with the modules) but many are lacking in some details and specific guidance. This combination goes beyond the normal install, activate, set permissions, configure path for a Drupal module. It deserves detailed documentation and instructions for use.

#1
jkeeline and I took a look at this, and this is how we resolved the double posts:
Listhandler does a check against server name ($_SERVER['SERVER_NAME']) to see if it should ignore the incoming mail - in our case this was always coming out false, and listhandler processed the mail, and the post was doubled.
After further investigation, we had 2 problems:
We were running cron fairly often to test the mail handling, so drush seemed like a good method :) In both those cases, the server name didn't match our actual domain name (list.example.com), and would process the message as a new incoming mail, and double post.
After changing our crontab to be http://list.example.com/cron.php , mailhandler and listhandler now work properly together, and ignore the messages that are generated from a forum post directly to the website.
Also, when using Drush to run cron, make sure to set the server name in a drushrc.php file to match the actual server name!
$_SERVER['SERVER_NAME'] = 'list.example.com';#2
I found that the tid value was not at issue.
Instead the crontab to run cron.php was
*/5 * * * * /usr/bin/wget -q -O /dev/null http://localhost/cron.php
instead of the domain name I was using under virtual hosting. Changing this allowed the proper checks and suppressed duplicat messages. Posting in hopes of saving someone else some grief.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.
#4
I still get this problem, even when playing with where cron.php gets requested from.
I've tried:
http://localhost/cron.php
http://website.com/cron.php
http://www.website.com/cron.php
http://localdnsname.local/cron.php
None of these solve the duplicate post issue.
I am encountering the same exact problem, where the local web forum post is inserted, and then the next time cron runs, it picks up the same post that was just sent to the mail list.
I did notice that setting the cron request to http://localdnsname.local/cron.php causes TID to be properly inserted into listhandler msgid table. (this was broken before, and bugging me) But I still get duplicate posts..
Any ideas?