Working with maillist.php [message #17188] |
Fri, 19 March 2004 03:23 |
Marticus
Messages: 272 Registered: June 2002
Karma: 1
|
Senior Member |
|
|
Hello. maillist.php seems to work just fine for my mailing lists; however, when I attempt to wrap the gateway script in a filter script I wrote in perl, the posting doesn't have a body.
Please let me know if I need to do some special magic when working with this stuff; I know it can be a bit tricky. This code receives the message on stdin and filters out everything between $tag and the string ~~ and sends the new message to maillist.php. Note that ARGV sends the maillist.php number listed in the following /etc/aliases entry (in this case it's 1):
fud-kias-general: "|/usr/local/bin/rmfooter.pl 1"
rmfooter.pl
#!/usr/bin/perl
use strict;
use warnings;
my $maillist = "/home/sites/kias/fudforum/data/scripts/maillist.php";
my $tag = "~mailing list information~";
my $footer = 0;
open FUD, "|-", "$maillist $ARGV[0]" or die "Cannot open: $!";
#print FUD $_ while <STDIN>;
while (<STDIN>) {
$footer = 1 if ($_ =~ /($tag)/);
print FUD $_ if ($footer ne 1);
$footer = 0 if ($_ =~ /(~~)/);
}
print FUD "[mailing list footer removed]";
close FUD;
|
|
|
Re: Working with maillist.php [message #17196 is a reply to message #17188] |
Fri, 19 March 2004 15:14 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
I am not an expert in Perl, but I suspect that your script somehow strips the body of the message.
To work properly, FUDforum needs to receive the complete message, which includes both body & headers. The headers are separated from the body by \r\n\r\n or \n\n, if this separator is not present that could be the cause of your problem as well.
FUDforum Core Developer
|
|
|
Re: Working with maillist.php [message #17199 is a reply to message #17188] |
Fri, 19 March 2004 16:27 |
Marticus
Messages: 272 Registered: June 2002
Karma: 1
|
Senior Member |
|
|
I tried this script with a test script in place of maillist.php and it prints out the message exactly as I expect; line for line with the exception of the content removed between $tag and ~~. I am not cho(m)ping, truncating, or anything of that sort. I even simplified the program to receive the input and send it to maillist.php without filtering.
#!/usr/bin/perl
use strict;
use warnings;
open FUD, "|-", "$maillist $ARGV[0]" or die "Cannot open: $!";
print FUD $_ while <STDIN>;
close FUD;
|
|
|
|
|