news2mail question...

Bill Davidsen davidsen at tmr.com
Mon Apr 28 14:00:33 UTC 2008


Julien ÉLIE wrote:
> 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;
>     }
>
>   
Why are you splitting $body instead of just printing it (print MAIL 
$body;)? Or adding a final "\n" if $body doesn't have one for some reason.

-- 
Bill Davidsen <davidsen at tmr.com>
  "Woe unto the statesman who makes war without a reason that will still
  be valid when the war is over..." Otto von Bismark 





More information about the inn-workers mailing list