FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts [message #17220] Fri, 19 March 2004 22:16 Go to next message
Marticus   United States
Messages: 272
Registered: June 2002
Karma: 1
Senior Member
I have been using FUD for some time now using /etc/aliases instead of procmail with the email gateway script maillist.php. My system is running mailman and postfix. I created the mailing list rule in Fud's administrative interface to have forum posts sent to kias-general mailing list and I created an alias as such:

fud-kias-general: "|/home/sites/kias/fudforum/data/scripts/maillist.php 1"

I added fud-kias-general to the kias-general membership with the 'not metoo' flag set to prevent looping. When a message is sent to the list, it also goes to fud-kias-general which points it to the maillist.php script which in turn posts it to the forum.

Note: in order for postfix to execute the script I had to make maillist.php executable, which by default is not.

Up until recently this had worked fine for me; however, I decided I needed more.

All of my forums get filled up with extra crap like quoted material and mailman footers.

Since I am no guru of regex, I had to resort to writing my own filter in perl using a combination of loops and keywords added to the mailman footer. Because postfix does not allow multiple pipes in /etc/aliases, e.g., fud-kias-general: "| filter.pl | maillist.php 1", I had to wrap the filter around maillist.php as such, fud-kias-general: "|filter.pl 1".

For those of you who know perl, this is a no brainer:

filter.pl:
--
#!/usr/bin/perl
use strict;
use warnings;

# Path to maillist.php
my $maillist = "/home/sites/kias/fudforum/data/scripts/maillist.php";

my $tag = "~mailing list information~"; # prepend mailman footer
my $endtag = "~~"; # append mailman footer

my $footer = 0;

# Open a pipe to maillist.php
# $ARGV[0] passes the list number 1 to maillist.php
open FUD, "|-", "$maillist $ARGV[0]" or die "Cannot open: $!";

# Pass through to maillist.php each line of the message
while (<STDIN>) {
$footer = 1 if ($_ =~ /($tag)/); # Start of mailman footer
print FUD $_ if ($footer ne 1);
$footer = 0 if ($_ =~ /($endtag)/); # End of mailman footer
}
print FUD "[mailing list footer removed]"; # added to bottom of email
close FUD; # close the pipe
--

Now I have filtered everything between and including $tag and $endtag sending a cleaner post to the forum.

I hope this helps someone else.
Re: Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts [message #19896 is a reply to message #17220] Wed, 15 September 2004 10:08 Go to previous messageGo to next message
rhinofly is currently offline  rhinofly   China
Messages: 15
Registered: August 2004
Karma: 0
Junior Member
Thanks,I'm using mailman with postfix too,I will try your way.
Re: Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts [message #167874 is a reply to message #17220] Mon, 29 October 2012 12:53 Go to previous messageGo to next message
ganesh is currently offline  ganesh
Messages: 2
Registered: October 2012
Karma: 0
Junior Member
Hi,
With this command :
"/var/www/FUDforum/scripts/maillist.php 2" in /etc/aliases file,

I am getting msgs bounced saying

"/var/www/FUDforum/scripts/maillist.php 2"
(reason: Can't create output)
(expanded from: <test-fud(at)mydomain(dot)com>)

----- Transcript of session follows -----
550 5.0.0 "/var/www/FUDforum/scripts/maillist.php 2"... Can't create output"

Any idea?

regards
Ganesh Kumar
Re: Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts [message #167875 is a reply to message #167874] Tue, 30 October 2012 03:22 Go to previous message
ganesh is currently offline  ganesh
Messages: 2
Registered: October 2012
Karma: 0
Junior Member
I added the "|" and recevied permission errors.

PHP Warning: include_once(/var/www/FUDforum/include/mime_decode.inc): failed to open stream: Permission denied in /var/www/FUDforum/include/core.inc on line 78
PHP Warning: include_once(): Failed opening '/var/www/FUDforum/include/mime_decode.inc' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/FUDforum/include/core.inc on line 78
PHP Warning: include_once(/var/www/FUDforum/include/scripts_common.inc): failed to open stream: Permission denied in /var/www/FUDforum/include/core.inc on line 78
PHP Warning: include_once(): Failed opening '/var/www/FUDforum/include/scripts_common.inc' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/FUDforum/include/core.inc on line 78
PHP Fatal error: Class 'fud_mime_msg' not found in /var/www/FUDforum/scripts/maillist.php on line 131
554 5.3.0 unknown mailer error 255


chmod 777 also doesnt solve this problem. Can anybody help me out?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Code fix for the fatal division by zero error if moderator uses "move selected" button
Next Topic: [MOD] 10 Recent Topics
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Dec 21 11:36:54 GMT 2024

Total time taken to generate the page: 0.04499 seconds