[plug] Mail Filtering

Matthew Robinson matt at zensunni.org
Wed Aug 28 16:12:21 WST 2002


Hi

The following script should do what you want.  If it doesn't work for you
let me know and I'll take another look at it.

Matt

----

#!/usr/bin/perl

use strict;
use warnings;

open(REGISTERED, '>'. 'public_html/registered.txt');

my $flash = "names=";
my $body = 0;

while(<>) {
    if (/^\s*$/) {
        $body = 1;
        next;
    }

    next unless ($body);

    print REGISTERED $_;

    chomp;

    $flash .= $_ . "<br>";
}

close(REGISTERED);

$flash =~ s/<br>$//g;

open(FLASH, '>'. 'public_html/registered_flash.txt');
print FLASH $flash;
close(FLASH);


--
s&&!msfQ!&&s&$&utvK&&s&(Q)&\1!sfiupoB&&s&^&reverse Ibdlfs&e&s&^&#
&&s&$&#!uojsq&&s&(.)&chr(ord($1)-1)&ge&s&(.*)&reverse $1&see


> Ok, some time back I asked for help getting an  email to replace a file in
> my public-html folder. The solution is below.
> -------------------------------------
> #!/usr/bin/perl
>
> #read the _whole_ file from stdin into $_;
> undef $/;
> $_=<STDIN>;
>
> #get rid of the email headers
> # headers are seperated from the body of the message by a blank line.
> s/^.*?\n\n//gs;
>
> open(DATA, ">public_html/registered_names.txt") or
>          die "failed to open public_html/registered_names.txt: $!\n";
> print DATA $_;
> close(DATA);
> --------
>
> Then in ~/.procmailrc do something like:
> ---
> :0
> * ^From:.*callen at corpus.wa.edu.au
> | /path/to/script
> ---
> -------------------------------------------------------
> What i now need is for it to work differently, i need it to split into 2
> different files.
> The email will look something like this
> ---------------------
> Matthew Whocare
> Sarah Wile
> Katlen Minkle
> Mill Nasf
> ---------------------
> The that i need are below
> ---------------------
> registered.txt
> ----
> Matthew Whocare
> Sarah Wile
> Katlen Minkle
> Mill Nasf
> ---------------------
> registered_flash.txt
> ----
> names=Matthew Whocare<br>Sarah Wile<br>Katlen Minkle<br>Mill Nasf
> ----
> I don't no how to script other than simple stuff.
> Thanks,
> Tim
>
>
> LinuxAlien
> Riverton, Perth, WA
>
> Australian Linux Technical Conference, Perth 2003 http://linux.conf.au



More information about the plug mailing list