Thread View: news.software.nntp
12 messages
12 total messages
Started by D. Stussy
Sun, 23 Nov 2008 02:51
news2mail script.
Author: D. Stussy
Date: Sun, 23 Nov 2008 02:51
Date: Sun, 23 Nov 2008 02:51
380 lines
13680 bytes
13680 bytes
I use a modified version of the script which has a configuration file that
has a THIRD parameter - SMTP envelope from address. Would this be useful
to everyone/anyone?
Why do that? Because some mailing lists (perhaps many, maybe eventually
all) will only allow messages to the list that come from list members.
Therefore, the sending address needs to be a list member. Therefore, what
I have is for "~news/etc/news2mail.conf" (not ".cf" - for consistency) is:
Newsfeeds-name List-to-address [List-sender-address]
Newsfeeds-name: Name used in the newsfeeds file for the gateway feed
(required).
List-to-address: List address to send to (required).
List-sender-address: Envelope-From address to use (a list member's
address; optional, NEW).
Mailing lists gated to/from the server should have their own mailbox
address to avoid confusion with a real participant's mailbox.
The SMTP envelope address is optional in the configuration file. However,
if it is specified, then only one mailing list may be the recipient of the
message.
To do: I wasn't skilled enough with perl to check for multiple entries all
the same for those lists that specify the parameter, but that is the next
logical step. Obviously, messages to multiple lists that have different
envelope-from values are currently a problem and should be handled by
sending multiple messages or generating an error. Currently, the "news"
user is used as the envelope-from sender when multiple lists receive a
posting, or when one list omits the third parameter.
Careful: I may have made other changes for my own preference. See the
diff at the end to identify those.
Changes include (besides the obvious):
1) Change of "~news/etc/news2mail.cf" => "~news/etc/news2mail.conf"
2) Hiding "Newsgroups:" header from mailing list, et. al.
-----
Manual page: news2mail(8)
It should probably contain a warning about looping messages between the
list and a news server (especially if the list doesn't protect itself
against looping). The newsfeeds entry for any news-list gateway should
include in the "exclude" field the domain of the list owner and a control
flag of "Ap". The examples should probably be updated to account for this.
news2mail script (complete first, diff second):
#! /usr/bin/perl
require '/var/lib/news/lib/innshellvars.pl';
# news to mail channel backend
#
# INN gives us
# @token@ addrs
# for each article that needs to be mailed. We invoke sm on the
# localhost to get the actual article and stuff it down sendmail's throat.
#
# This program expect to find a file that maps listname to listaddrs,
# @prefix@/etc/news2mail.cf
# which must contain address mapping pairs such as
#
# big-red-ants@ucsd.edu big-red-ants-digest@ucsd.edu
#
# where the first token is the name fed to us from INN, and which is
# also placed in the To: header of the outgoing mail. It's probably
# the subscriber's list submittal address so that replies go to the
# right place. The second token is the actual address sendmail ships
# the article to.
#
# 2008-06-26: Added a third, optional token for envelope-from address if
# mailing to only one destination/list. Also changed configuration file
# extension from ".cf" to ".conf" for INN naming consistency. - D. Stussy
#
# In the INN newsfeeds file, you need to have a channel feed:
# n2m!:!*:Ac,Tc,Wn*:@prefix@/bin/news2mail
# and a site for each of the various mailing lists you're feeding,
# such as
# big-red-ants@ucsd.edu/ucsd.edu:rec.pets.redants.*:Ap,Tm:n2m!
#
# Error handling is nearly nonexistent.
#
# - Brian Kantor, UCSD Aug 1998
require 5.006;
use FileHandle;
use Sys::Syslog;
use strict;
my $cfFile = $inn::pathetc . "/news2mail.conf" ;
my $sendmail = $inn::mta ;
my $sm = $inn::pathbin . "/sm" ;
my %maddr = ();
my %saddr = ();
openlog('news2mail', 'pid', 'mail');
syslog('info', 'begin');
#
# load the list names and their mail addresses from conf file
# #comments and blank lines are ignored
#
unless (open CF, "< $cfFile") {
syslog('notice', 'CF open failed %m');
die "bad CF";
}
while ( <CF> ) {
next if /^#|^\s+$/;
my ( $ln, $ma, $sa ) = split /\s+/;
$maddr{ $ln } = $ma;
$saddr{ $ln } = $sa if $sa =~ /.+/;
$sa = $inn::newsuser if !defined $saddr{ $ln };
syslog('debug',"List=$ln, To=<$ma>, From=<$sa>");
}
close CF;
#
# for each incoming line from the INN channel
#
while ( <STDIN> ) {
chomp;
syslog('info', $_);
my ($token, $lnames) = split /\s+/, $_, 2;
my @addrs = split /\s+/, $lnames;
my @good = grep { defined $maddr{$_} } @addrs;
my @bad = grep { !defined $maddr{$_} } @addrs;
if (! @good) {
syslog('notice', "unknown list(s): $lnames");
next;
}
if (@bad) {
syslog('info', 'skipping list(s): ', join(' ', @bad));
}
my $sa = $inn::newsuser;
my @src = grep { defined $saddr{$_} } @good;
$sa = @saddr{@src} if @src == 1;
# If multiple lists have different addresses in the saddr{} array, we
# should send multiple copies, each with its different $sa=saddr{}
# mapping. Note that NULL entries should be ignored, so that
# if saddr{src} for all sources yields only one non-null entry, use it.
# Otherwise, use the specific address for each list. Someone who
# knows perl better than I do needs to write this. - D. Stussy.
mailto($token, $sa, @maddr{@good});
}
syslog ("info", "end") ;
exit 0;
sub mailto {
my($t, $s, @a) = @_ ;
my $sendmail = $inn::mta ;
$sendmail =~ s!\s*%s!! ;
my @command = (split (' ', $sendmail), '-ee', '-odq', "-f$s",
"-pNNTP:$inn::pathhost", @a);
syslog('debug', join(' ', @command));
unless (open(SM, '|-', @command)) {
syslog('error', join(' ', '|', @command), 'failed!');
die "bad $sendmail";
}
my $smgr = "$sm -q $t |";
unless (open(SMGR, $smgr)) {
syslog('error', "$smgr failed!");
die "bad $smgr";
}
# header
while ( <SMGR> ) {
chomp;
# empty line signals end of header
if ( /^$/ ) {
print SM "To: @a\n\n";
last;
}
s/^X-Received:/Received:/i;
next if /^NNTP-Posting-Date:/i;
next if /^NNTP-Posting-Host:/i;
next if /^Newsgroups:/i;
next if /^Lines:/i;
next if /^Xref:/i;
next if /^Path:/i;
next if /^To:/i;
next if /^X-/i;
print SM "$_\n";
}
# body
while ( <SMGR> ) {
print SM $_;
}
close(SMGR);
close(SM);
}
!diff -ub /usr/src/inn-STABLE-20081021/backends/news2mail
~news/bin/news2mail
--- /usr/src/inn-STABLE-20081021/backends/news2mail 2008-10-23
03:29:32.000000000 +0000
+++ /var/lib/news/bin/news2mail 2008-11-20 00:00:00.000000000 +0000
@@ -6,8 +6,7 @@
# INN gives us
# @token@ addrs
# for each article that needs to be mailed. We invoke sm on the
-# localhost to get the actual article and stuff
-# it down sendmail's throat.
+# localhost to get the actual article and stuff it down sendmail's throat.
#
# This program expect to find a file that maps listname to listaddrs,
# @prefix@/etc/news2mail.cf
@@ -21,8 +20,12 @@
# right place. The second token is the actual address sendmail ships
# the article to.
#
+# 2008-06-26: Added a third, optional token for envelope-from address if
+# mailing to only one destination/list. Also changed configuration file
+# extension from ".cf" to ".conf" for INN naming consistency. - D. Stussy
+#
# In the INN newsfeeds file, you need to have a channel feed:
-# n2m!:!*:Tc,Ac,Wn*:@prefix@/bin/news2mail
+# n2m!:!*:Ac,Tc,Wn*:@prefix@/bin/news2mail
# and a site for each of the various mailing lists you're feeding,
# such as
# big-red-ants@ucsd.edu:rec.pets.redants.*:Tm:n2m!
@@ -37,31 +40,31 @@
use Sys::Syslog;
use strict;
-my $cfFile = $inn::pathetc . "/news2mail.cf" ;
+my $cfFile = $inn::pathetc . "/news2mail.conf" ;
my $sendmail = $inn::mta ;
my $sm = $inn::pathbin . "/sm" ;
my %maddr = ();
+my %saddr = ();
-#
-# the syslog calls are here but don't work on my system
-#
openlog('news2mail', 'pid', 'mail');
-
syslog('info', 'begin');
#
-# load the list names and their mail addresses from cf file
+# load the list names and their mail addresses from conf file
# #comments and blank lines are ignored
#
unless (open CF, "< $cfFile") {
syslog('notice', 'CF open failed %m');
die "bad CF";
- }
+}
while ( <CF> ) {
next if /^#|^\s+$/;
- my ( $ln, $ma ) = split /\s+/;
+ my ( $ln, $ma, $sa ) = split /\s+/;
$maddr{ $ln } = $ma;
+ $saddr{ $ln } = $sa if $sa =~ /.+/;
+ $sa = $inn::newsuser if !defined $saddr{ $ln };
+ syslog('debug',"List=$ln, To=<$ma>, From=<$sa>");
}
close CF;
@@ -70,49 +73,45 @@
#
while ( <STDIN> ) {
chomp;
-
syslog('info', $_);
-
my ($token, $lnames) = split /\s+/, $_, 2;
my @addrs = split /\s+/, $lnames;
-
my @good = grep { defined $maddr{$_} } @addrs;
my @bad = grep { !defined $maddr{$_} } @addrs;
if (! @good) {
- syslog('notice', "unknown listname $_");
+ syslog('notice', "unknown list(s): $lnames");
next;
}
-
if (@bad) {
- syslog('info', 'skipping unknown lists: ', join(' ',
@bad));
+ syslog('info', 'skipping list(s): ', join(' ', @bad));
}
- mailto($token, $lnames, @maddr{@good});
- }
-
+ my $sa = $inn::newsuser;
+ my @src = grep { defined $saddr{$_} } @good;
+ $sa = @saddr{@src} if @src == 1;
+ mailto($token, $sa, @maddr{@good});
+}
syslog ("info", "end") ;
-
exit 0;
sub mailto {
- my($t, $l, @a) = @_ ;
+ my($t, $s, @a) = @_ ;
my $sendmail = $inn::mta ;
$sendmail =~ s!\s*%s!! ;
- my @command = (split (' ', $sendmail), '-ee', '-fnews', '-odq',
@a);
-# @command[0] = '/usr/local/bin/debug';
+ my @command = (split (' ', $sendmail), '-ee', '-odq', "-f$s",
+ "-pNNTP:$inn::pathhost", @a);
- syslog('info', join(' ', @command));
+ syslog('debug', join(' ', @command));
unless (open(SM, '|-', @command)) {
- syslog('notice', join(' ', '|', @command), 'failed!');
+ syslog('error', join(' ', '|', @command), 'failed!');
die "bad $sendmail";
}
my $smgr = "$sm -q $t |";
-
unless (open(SMGR, $smgr)) {
- syslog('notice', "$smgr failed!");
+ syslog('error', "$smgr failed!");
die "bad $smgr";
}
@@ -122,24 +121,18 @@
# empty line signals end of header
if ( /^$/ ) {
- print SM "To: $l\n\n";
+ print SM "To: @a\n\n";
last;
}
-
- #
- # skip unnecessary headers
- #
+ s/^X-Received:/Received:/i;
next if /^NNTP-Posting-Date:/i;
next if /^NNTP-Posting-Host:/i;
- next if /^X-Trace:/i;
+ next if /^Newsgroups:/i;
+ next if /^Lines:/i;
next if /^Xref:/i;
next if /^Path:/i;
-
- #
- # convert Newsgroups header into X-Newsgroups
- #
- s/^Newsgroups:/X-Newsgroups:/i;
-
+ next if /^To:/i;
+ next if /^X-/i;
print SM "$_\n";
}
@@ -147,7 +140,6 @@
while ( <SMGR> ) {
print SM $_;
}
-
close(SMGR);
close(SM);
- }
+}
Re: news2mail script.
Author: Julien ÉLIE
Date: Sun, 23 Nov 2008 10:28
Date: Sun, 23 Nov 2008 10:28
60 lines
3327 bytes
3327 bytes
Hi D. Stussy,
> I use a modified version of the script which has a configuration file that
> has a THIRD parameter - SMTP envelope from address. Would this be useful
> to everyone/anyone?
[...]
> Why do that? Because some mailing lists (perhaps many, maybe eventually
> all) will only allow messages to the list that come from list members.
> Therefore, the sending address needs to be a list member. Therefore, what
> I have is for "~news/etc/news2mail.conf" (not ".cf" - for consistency) is:
>
> Newsfeeds-name List-to-address [List-sender-address]
>
> Newsfeeds-name: Name used in the newsfeeds file for the gateway feed
> (required).
> List-to-address: List address to send to (required).
> List-sender-address: Envelope-From address to use (a list member's
> address; optional, NEW).
In fact, you want to change the meaning of the first parameter.
Currently in newsfeeds:
n2m!:!*:Acp,Tc,Wn*:<pathbin>/news2mail
news-software-nntp@sender.org:news.software.nntp:Tm:n2m!
And in news2mail.cf:
news-software-nntp@sender.org address@list.org
where the first parameter is the sender's address and the second one
the address of the mailing-list.
Then you want to use the third (optional) parameter as the first one
and allow to put the name you want in newsfeeds, which enables you to have
the same sender's address for several mailing-lists.
And use it in the "-f" flag passed to sendmail.
It is a useful improvement.
> 2) Hiding "Newsgroups:" header from mailing list, et. al.
It is changed to X-Newsgroups:.
> -#
> -# the syslog calls are here but don't work on my system
> -#
> openlog('news2mail', 'pid', 'mail');
It is true that it does not work on some systems. The patch is here:
http://inn.eyrie.org/viewcvs/trunk/backends/news2mail.in?r1=7687&r2=8183&view=patch
--
Julien ÉLIE
« Medicus dedit qui temporis morbo curam,
Is plus remedii quam cutis sector dedit. »
Re: news2mail script.
Author: D. Stussy
Date: Sun, 23 Nov 2008 21:17
Date: Sun, 23 Nov 2008 21:17
153 lines
7952 bytes
7952 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:ggbb82$umo$1@news.trigofacile.com...
> > I use a modified version of the script which has a configuration file
that
> > has a THIRD parameter - SMTP envelope from address. Would this be
useful
> > to everyone/anyone?
> [...]
> > Why do that? Because some mailing lists (perhaps many, maybe
eventually
> > all) will only allow messages to the list that come from list members.
> > Therefore, the sending address needs to be a list member. Therefore,
what
> > I have is for "~news/etc/news2mail.conf" (not ".cf" - for consistency)
is:
> >
> > Newsfeeds-name List-to-address [List-sender-address]
> >
> > Newsfeeds-name: Name used in the newsfeeds file for the gateway feed
> > (required).
> > List-to-address: List address to send to (required).
> > List-sender-address: Envelope-From address to use (a list member's
> > address; optional, NEW).
>
> In fact, you want to change the meaning of the first parameter.
> Currently in newsfeeds:
>
> n2m!:!*:Acp,Tc,Wn*:<pathbin>/news2mail
> news-software-nntp@sender.org:news.software.nntp:Tm:n2m!
>
> And in news2mail.cf:
>
> news-software-nntp@sender.org address@list.org
>
> where the first parameter is the sender's address and the second one
> the address of the mailing-list.
When I looked at the script, it wasn't evident that such was being used
that way. It's ONLY use was that of a feed name from newsfeeds that must
match the first column entry from the news2mail configuration file. The
comments and examples suggested that it be used as the sending mailbox, but
such seems not to actually be used as such - and definently not as the
envelope sender. Its only use is that it was copied into the "To:" header!
The "To:" header should have the list's mailbox name, not the sender's
mailbox.
The original script passes three things to its mailto() function:
1) The article storage token.
2) An array of newsfeed feednames. (from)
3) An array of matching list names. (to)
The array of feednames isn't pruned to exclude entries that were absent
from the configuration file. The original script will pass the bad
(missing from configuration) feednames to the mailto() function. This
means that the two arrays will not be of equal number of elements.
Shouldn't they match? Regardless, one can really have only one sender per
message. To set this value to be the sending mailbox would also preclude
sending certain gated messages that CAN be sent as one message to multiple
lists from happening.
The original mailto() function forces "-fnews" to sendmail - thus forcing
the news user to be the envelope-from mailbox. That can be problematic for
sendmail - as it cannot look at the sending mailbox to determine delivery
(for messages from the list). What sendmail needs is either a separate
mailbox for every list or a fixed mailbox with a "plus" field to determine
its list->newsgroup mapping. Since the newsgroup->list mapping must set
the sender to the same address and not merely the "news" user (for lists
that require senders to be subscribers), the original script doesn't work.
My version passes the $sa variable instead to use as the sendmail "-f"
parameter instead of the hardcoded value. $sa defaults to the "news" user,
but picks up the third parameter from the configuration file for lists
where it is set.
One advantage here is that a message crossposted to multiple groups that
map to multiple lists CAN be sent as ONE e-mail message (with multiple
lists as recipients) as long as the destination lists do not require, or at
most only one of them does, the envelope-from to be set. As noted, the
case where two or more lists require that the envelope-from be set (even if
to the same value) is beyond my perl programming skills. Two or more lists
that require different sender values will need multiple messages,
presumedly with those that don't need such (3rd parameter from
configuration missing) combined into the first message/loop iteration. The
original script implies a 1-to-1 mapping: One SMTP message for every gated
article, even if crossposted and even if they could be combined. However,
the news2mail program is set up as a funneled channel in newsfeeds,
implying multiple matches should be handled as one - and multiple matching
funneled feeds will result in a single call to the script.
> Then you want to use the third (optional) parameter as the first one
> and allow to put the name you want in newsfeeds, which enables you to
have
> the same sender's address for several mailing-lists.
> And use it in the "-f" flag passed to sendmail.
>
> It is a useful improvement.
Setting the feed name for a list to be the sender's address is not
intuitive as to the identification of the mailing list. Setting the
feedname to a logically connected name is better. Example (new script):
newsfeeds:
list-bind-users/lists.isc.org:!*,comp.protocols.dns.bind:Ap,Tm:n2m!
n2m!:!*:Ac,Tc,Wn*:...news/bin/news2mail
news2mail.conf:
list-bind-users bind-users@lists.isc.org
news+bind-users@local_news_server
sendmail's virtusers:
news+bind-users@local_news_server comp.protocols.dns.bind.USENET
is much more intuitive than (original script usage):
newsfeeds:
bind-list@local_news_server/lists.isc.org:!*,comp.protocols.dns.bind:Ap,Tm:
n2m!
n2m!:!*:Ac,Tc,Wn*:...news/bin/news2mail
news2mail.conf:
bind-list@local_news_server bind-users@lists.isc.org
sendmail's virtusers:
news@local_news_server comp.protocols.dns.bind.USENET
(works if it's the ONLY group so gated. Otherwise, procmail must be used.)
(I do not actually gate the bind-users list, but isc.org does. Note the
use of "Ap" to protect the list from feeding back new arrivals from the
list; a suggestion that is missing from the original.)
> > 2) Hiding "Newsgroups:" header from mailing list, et. al.
>
> It is changed to X-Newsgroups:.
In my version, I prefer to hide that from the list completely. I see no
reason why this mapping should be revealed to the list, especialy when some
lists sem to be mapped to different groups by separate name servers (where
some are local groups only while others are propagated).
> > -#
> > -# the syslog calls are here but don't work on my system
> > -#
> > openlog('news2mail', 'pid', 'mail');
>
> It is true that it does not work on some systems. The patch is here:
>
http://inn.eyrie.org/viewcvs/trunk/backends/news2mail.in?r1=7687&r2=8183&view=patch
That one wasn't my comment but is present in the original script (INN
2.4.5).
Re: news2mail script.
Author: Julien ÉLIE
Date: Sun, 30 Nov 2008 12:49
Date: Sun, 30 Nov 2008 12:49
36 lines
2404 bytes
2404 bytes
Hi D. Stussy, >I use a modified version of the script which has a configuration file that > has a THIRD parameter - SMTP envelope from address. Would this be useful > to everyone/anyone? Thanks. Committed to CURRENT (INN 2.5.0). New updated samples for newsfeeds and news2mail.cf are available. > It should probably contain a warning about looping messages between the > list and a news server (especially if the list doesn't protect itself > against looping). The newsfeeds entry for any news-list gateway should > include in the "exclude" field the domain of the list owner and a control > flag of "Ap". The examples should probably be updated to account for this. All right. By the way, is it necessary to use "sendmail -q" to send mails from news2mail? (as stated in the man page) How often do you issue the command? > + s/^X-Received:/Received:/i; Not done. X-Received: headers are removed by news2mail, as well as all headers started with "X-". -- Julien ÉLIE « L'informatique, c'est l'art de passer 15 jours à essayer de gagner quelques millisecondes... »
Re: news2mail script.
Author: Julien ÉLIE
Date: Sun, 30 Nov 2008 12:50
Date: Sun, 30 Nov 2008 12:50
19 lines
2080 bytes
2080 bytes
Hi D. Stussy, > When I looked at the script, it wasn't evident that such was being used > that way. It's ONLY use was that of a feed name from newsfeeds that must > match the first column entry from the news2mail configuration file. The > comments and examples suggested that it be used as the sending mailbox, but > such seems not to actually be used as such - and definently not as the > envelope sender. Its only use is that it was copied into the "To:" header! > The "To:" header should have the list's mailbox name, not the sender's > mailbox. Your patch makes news2mail far better. Thanks. -- Julien ÉLIE « La vie est un sommeil, l'amour en est le rêve et vous aurez vécu si vous avez aimé. » (Alfred de Musset)
Re: news2mail script.
Author: D. Stussy
Date: Sun, 30 Nov 2008 22:25
Date: Sun, 30 Nov 2008 22:25
48 lines
2891 bytes
2891 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:ggu25c$1r8$1@news.trigofacile.com... > >I use a modified version of the script which has a configuration file that > > has a THIRD parameter - SMTP envelope from address. Would this be useful > > to everyone/anyone? > > Thanks. Committed to CURRENT (INN 2.5.0). Actually, I'm hoping that someone can figure out how to loop through sending when two or more lists each want a different sender. If someone figures out how to do that, that is what should be committed. > New updated samples for newsfeeds and news2mail.cf are available. Unless you changed it, note that I used "news2mail.conf". The other INN programs use ".conf", not ".cf", so I changed it to conform. > > It should probably contain a warning about looping messages between the > > list and a news server (especially if the list doesn't protect itself > > against looping). The newsfeeds entry for any news-list gateway should > > include in the "exclude" field the domain of the list owner and a control > > flag of "Ap". The examples should probably be updated to account for this. > > All right. > > > By the way, is it necessary to use "sendmail -q" to send mails from news2mail? > (as stated in the man page) > How often do you issue the command? No. However, I run my sendmail daemon as "sendmail -bd -q12". Perhaps it is needed when another MTA program is the main one used on the host. > > > + s/^X-Received:/Received:/i; > > Not done. X-Received: headers are removed by news2mail, as well as all headers > started with "X-". Personal choice on my end. Do what you feel is correct for most.
Re: news2mail script.
Author: Julien ÉLIE
Date: Mon, 01 Dec 2008 18:06
Date: Mon, 01 Dec 2008 18:06
38 lines
2381 bytes
2381 bytes
Hi D. Stussy,
>> Thanks. Committed to CURRENT (INN 2.5.0).
>
> Actually, I'm hoping that someone can figure out how to loop through
> sending when two or more lists each want a different sender. If someone
> figures out how to do that, that is what should be committed.
Instead of:
my $sa = $INN::Config::newsuser;
my @src = grep { defined($saddr{$_}) } @good;
$sa = @saddr{@src} if (@src == 1);
mailto($token, $sa, @maddr{@good});
you will have to call mailto() for each list in @good:
foreach (@good) {
# $_ contains an element of @good.
# Doesn't $sa{$_} contain the sender?
}
>> New updated samples for newsfeeds and news2mail.cf are available.
>
> Unless you changed it, note that I used "news2mail.conf". The other INN
> programs use ".conf", not ".cf", so I changed it to conform.
There is also send-uucp.cf.
I did not change the name of news2mail.cf.
--
Julien ÉLIE
« Pour célébrer ce jour heureux, buvons un coup, buvons-en deux. »
(Aristophane)
Re: news2mail script.
Author: D. Stussy
Date: Mon, 01 Dec 2008 22:02
Date: Mon, 01 Dec 2008 22:02
41 lines
2679 bytes
2679 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:gh193g$ln5$1@news.trigofacile.com...
> >> Thanks. Committed to CURRENT (INN 2.5.0).
> >
> > Actually, I'm hoping that someone can figure out how to loop through
> > sending when two or more lists each want a different sender. If
someone
> > figures out how to do that, that is what should be committed.
>
> Instead of:
>
> my $sa = $INN::Config::newsuser;
> my @src = grep { defined($saddr{$_}) } @good;
> $sa = @saddr{@src} if (@src == 1);
> mailto($token, $sa, @maddr{@good});
>
> you will have to call mailto() for each list in @good:
>
> foreach (@good) {
> # $_ contains an element of @good.
> # Doesn't $sa{$_} contain the sender?
> }
Not exactly. One would have to call mailto() for each UNIQUE SENDER in
saddr{}. A null entry (or no entry) in saddr{} for a given list can match
any non-null entry (but should only actually be matched to one - e.g. the
first). Note that the number of unique senders is not necessarily the same
as the number of lists.
> >> New updated samples for newsfeeds and news2mail.cf are available.
> >
> > Unless you changed it, note that I used "news2mail.conf". The other
INN
> > programs use ".conf", not ".cf", so I changed it to conform.
>
> There is also send-uucp.cf.
> I did not change the name of news2mail.cf.
vs. incoming.conf, inn.conf, innfeed.conf, etc.... Your choice.
Re: news2mail script.
Author: Julien ÉLIE
Date: Sun, 21 Dec 2008 19:37
Date: Sun, 21 Dec 2008 19:37
24 lines
2114 bytes
2114 bytes
Hi D. Stussy,
>> Thanks. Committed to CURRENT (INN 2.5.0).
>
> Actually, I'm hoping that someone can figure out how to loop through
> sending when two or more lists each want a different sender. If someone
> figures out how to do that, that is what should be committed.
I have just filled your request in ticket #103:
http://inn.eyrie.org/trac/ticket/103
I see that two other issues exist in news2mail:
http://inn.eyrie.org/trac/ticket/72 (news2mail always queues messages)
http://inn.eyrie.org/trac/ticket/73 (news2mail's crosspost handling code generates bad To: headers)
--
Julien ÉLIE
« La médecine est un métier dangereux. Ceux qui ne meurent pas
peuvent vous faire un procès. » (Coluche)
Re: news2mail script.
Author: D. Stussy
Date: Sun, 21 Dec 2008 23:34
Date: Sun, 21 Dec 2008 23:34
48 lines
2858 bytes
2858 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:gim5u2$jo9$1@news.trigofacile.com...
> Hi D. Stussy,
> >> Thanks. Committed to CURRENT (INN 2.5.0).
> >
> > Actually, I'm hoping that someone can figure out how to loop
through
> > sending when two or more lists each want a different sender. If
someone
> > figures out how to do that, that is what should be committed.
>
> I have just filled your request in ticket #103:
>
> http://inn.eyrie.org/trac/ticket/103
I know it's going ot be something like this (pseudocode, not perl):
loop = 0;
foreach(@saddr[@good] as sa) {
recipient_list_array=empty
foreach(@good) {
if (sa == saddr[good]) then append maddr[good] to
recipient_list_array;
if (loop == 0 and saddr[good] == NULL) then append ....
}
send_mail(....)
loop=1
}
This way, each call to the mail sending routine sends using each
source address ONCE - to multiple destination lists, and those with a
NULL source address get added to the message of the first loop.
Therefore, instead of sending "# of good" messages, one sends "# of
unique sender" messages, which may be less but all messages still
cover all mailing lists in "good." I just don't know how to write
this in perl.
> I see that two other issues exist in news2mail:
>
> http://inn.eyrie.org/trac/ticket/72 (news2mail always queues
messages)
> http://inn.eyrie.org/trac/ticket/73 (news2mail's crosspost
handling code generates bad To: headers)
I believe my changes to the script make issue #73 moot. I might have
also dealt with #72 as well.
Re: news2mail script.
Author: Julien ÉLIE
Date: Mon, 22 Dec 2008 10:24
Date: Mon, 22 Dec 2008 10:24
56 lines
3634 bytes
3634 bytes
Hi D. Stussy,
> This way, each call to the mail sending routine sends using each
> source address ONCE - to multiple destination lists, and those with a
> NULL source address get added to the message of the first loop.
> Therefore, instead of sending "# of good" messages, one sends "# of
> unique sender" messages, which may be less but all messages still
> cover all mailing lists in "good." I just don't know how to write
> this in perl.
Thanks for the pseudocode. I have just added it in a comment of #103.
>> I see that two other issues exist in news2mail:
>>
>> http://inn.eyrie.org/trac/ticket/72 (news2mail always queues messages)
>> http://inn.eyrie.org/trac/ticket/73 (news2mail's crosspost
>> handling code generates bad To: headers)
>
> I believe my changes to the script make issue #73 moot. I might have
> also dealt with #72 as well.
For #73:
--------
There is still
print SM "To: @a\n\n";
in the code, and @a is @maddr{@good}, thus an array, which generates a broken
header because it is expanded with spaces instead of commas.
Wouldn't
print SM "To: ".join(",", @a)."\n\n";
solve the issue?
For #72:
--------
We still have '-odq' in the call of sendmail.
According to my man page (which points to Exim...):
-odq This option applies to all modes in which Exim accepts incom-
ing messages, including the listening daemon. It specifies
that the accepting process should not automatically start a
delivery process for each message received. Messages are
placed on the queue, and remain there until a subsequent
queue runner process encounters them. There are several con-
figuration options (such as queue_only) that can be used to
queue incoming messages under certain conditions. This option
overrides all of them and also -odqs. It always forces queue-
ing.
--
Julien ÉLIE
« J'ai six loyaux serviteurs, ils m'ont appris tout ce que je sais :
ils s'appellent quoi, pourquoi, quand, comment, où et qui. » (Rudyard Kipling)
Re: news2mail script.
Author: Russ Allbery
Date: Mon, 22 Dec 2008 22:15
Date: Mon, 22 Dec 2008 22:15
22 lines
1880 bytes
1880 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
> For #73:
> --------
> There is still
> print SM "To: @a\n\n";
> in the code, and @a is @maddr{@good}, thus an array, which generates a broken
> header because it is expanded with spaces instead of commas.
>
> Wouldn't
> print SM "To: ".join(",", @a)."\n\n";
> solve the issue?
Yup, I think that's all that's needed. I almost just fixed it instead of
creating the bug, but I was on a roll opening bugs and didn't want to
switch contexts.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads