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

Home » General » General Chit Chat » Working with maillist.php
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Working with maillist.php [message #17188] Fri, 19 March 2004 03:23 Go to next message
Marticus   United States
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 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 Go to previous messageGo to next message
Marticus   United States
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;
Re: Working with maillist.php [message #17202 is a reply to message #17199] Fri, 19 March 2004 17:04 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
This is likely to be a permissions issue, whereby the maillist.php does not have permissions to write to the file where message bodies are being stored.
Re: Working with maillist.php [message #17226 is a reply to message #17188] Fri, 19 March 2004 22:33 Go to previous message
Marticus   United States
Messages: 272
Registered: June 2002
Karma: 1
Senior Member
Ilia has helped me fix this problem.

http://fud.prohost.org/forum/index.php?t=msg&th=3574&start=0&ri d=251&SQ=ad0de3a2c03f51e8aa998d7015573481
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Accelerators.
Next Topic: File Uploading - Where's it go?
Goto Forum:
  

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

Current Time: Thu Nov 21 12:12:14 GMT 2024

Total time taken to generate the page: 0.02980 seconds