news2mail question...

Julien ÉLIE julien at trigofacile.com
Sat Apr 26 20:50:57 UTC 2008


Hi Nick,

> Does anyone have any hints for me on how I might filter data that goes to the
> news2mail program?  I'm trying to couple a web and e-mail-based ticket
> tracking system with INN, and when people post replies to threads on the
> newsgroup with certain subjects (subjects that indentify them as tickets)
> I'd like those replies to get sent off to the e-mail system so that the
> correspondence can be added to the ticket.  However, I don't want all
> news posts going to the ticket system - this would create a slew of
> unnecessary new tickets in the system and cause a lot of unwanted e-mail.
> Hints, anyone?

news2mail is a channel feed in newsfeeds and receives a token so it is not
easy to do what you want with it.

Why not use filter_nnrpd.pl and see if articles posted are in the right
group with a References: header and/or a subject which identifies them
as tickets?  Then, you can easily send them by mail.

Something like that:

    if (($hdr{Newsgroups} =~ /your\.group/i) && ($hdr{Subject} =~ /what-you-want/i)) {

        open (MAIL, "|/usr/lib/sendmail -t") or return '';
        print MAIL "To: <your at mail>\n";
        print MAIL "From: <another at mail>\n";
        print MAIL "MIME-Version: 1.0\n";
        [...]
        print MAIL "Subject: $hdr{Subject}\n\n";

        my (@lines) = split(/\n/, $body);
        for ($i=0; $i < scalar(@lines); $i++) {
            print MAIL $lines[$i]."\n";
        }

        close MAIL;
    }

-- 
Julien ÉLIE

« -- Il est parti comme il est venu...
  -- Il ne faisait que passer... » (Astérix) 



More information about the inn-workers mailing list