Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts [message #17220] |
Fri, 19 March 2004 17:16 |
Marticus
Messages: 272 Registered: June 2002
Karma: 1
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
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 #167875 is a reply to message #167874] |
Mon, 29 October 2012 23:22 |
|
ganesh
Messages: 2 Registered: October 2012
Karma: 0
|
Junior Member |
add to buddy list ignore all messages by this user
|
|
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?
|
|
|