| mail2news(1) | NetBSD Reference Manual | mail2news(1) |
mail2news --receive an article of mail-list and deliver it as a news.
mail2news [ -f cf_file ]
[ -n newsgroup ]
[ -m d ]
[ serverhost ]
mail2news -v
Mail2news converts a mail to news file and post the article to
newsgroup via
nnrpd(8). If no
newsgroup is given,
mail2news try to determine appropriate newsgroup(s) from the rule described in
conf_file.
If
serverhost argument is given, it is used for the News server hostname,
which default value is taken from NNTPSERVER environment variable.
If no server is specified nor NNTPSERVER environment variable set,
mail2news uses DEFAULT_SERVER compile option as newsserver.
Mail2news reads the conversion tables from its configuration file, which default
value is
/usr/local/share/mailtonews/mailtonews.conf. You can specify alternate file with
-f option. For information of the format of the configuration file, see below.
Next,
mail2news reads unix mail form from stdin and creates news file and original mail
copy in the temporary directory. These temporary files are unlinked
when news server accepts the post. If post fails,
mail2news leave original mail file, converted newsfile and error output from
nnrpd(8) at the
serverhost in the temporary directory.
If the environment variable TMPDIR is set,
mail2news uses it as the directory in which to put temporary files instead of the
default, /var/tmp.
The
mail2news utility exits 75 when temporary fail, and other case, which includes
permanent error, exit 0.
Mailtonews modifies few article headers due to the difference between the formats
of mail and those of news.
The following headers, if present, are removed: ``Date-Received:'', ``Followup-To:'', ``From'' (Unix_from) , ``NNTP-Posting-Host:'', ``Posted'', ``Posting-Version:'', ``Received:'', ``Relay-Version:'', ``X-UIDL'', and ``Xref:''.
Following headers treated specially.
In-Reply-To:: This field sometimes contains Message-Id to which the poster replied.
So, if it contains some message-id,
mail2news add it to the
References: field.
To:, Cc:, Sender: and
Deliverd-To:: These headers are expected contain mailing-list name, so
mail2news tries to guess appropriate newsgroups.
From:: If this field matches "majordomo@",
mail2news won't convert to news, but just forward to root.
So you can use pseudo user account to subscribe mailing lists.
And if this field contains `newline', convert it to `space'.
Message-Id:: Some mailers and/or mailing list programs create message-id which
is not appropriate for news, such as message-id contains white space,
ended with ".>", or null hostname ( no string between @ and > ).
Mail2news converts such message-id by replacing white space with dot, removing
dot before ">" and adding sender's hostname respectively.
If
mail2news changes message-id, it will add original message-id with
X-M2N-Message-Id: identifier for the future reference.
All other headers, unless not duplicate, will be copied to news file.
And
mail2news add
X-M2N-Version: headers.
Configuration file, mailtonews.conf, consists of lines with two fields: the mailing list name and the newsgroup name. The mailing list name is separated from the newsgroup name by one or more white spaces. The lines begin with ``#'' treated as comments. At least name of the mailing lists should be represented by lower case letters.
This command is normally appeared in /etc/aliases as
| netbsd-current: | "| /usr/local/bin/mail2news" |
Typical mailtonews.conf file looks like,
| # Mailing List Name | Newsgroup Name |
| current-users@netbsd.org | netbsd.current |
| netbsd-announce@netbsd.org | netbsd.announce |
| netbsd-bugs@netbsd.org | netbsd.bugs |
| netbsd-help@netbsd.org | netbsd.help |
| netbsd-ports@netbsd.org | netbsd.ports |
| netbsd-questions@netbsd.org | netbsd.help |
| netbsd-users@netbsd.org | netbsd.users |
| port-i386@netbsd.org | netbsd.ports.i386 |
| port-alpha@netbsd.org | netbsd.ports.alpha |
| source-changes@netbsd.org | netbsd.source |
With the above configuration file, the mail header
Received: from tera.fukui-med.ac.jp (root@tera.fukui-med.ac.jp [192.168.84.21]) by tack.fukui-med.ac.jp (8.8.5/8.8.5/tack970715) with ESMTP id WAA07763 for <gnats-bugs@gnats.netbsd.org>; Fri, 8 Aug 1997 22:04:35 +0900 (JST) Received: (from tacha@localhost) by tera.fukui-med.ac.jp (8.8.6/8.8.5/tera970421) id WAA11611; Fri, 8 Aug 1997 22:04:31 +0900 (JST) Message-Id: <199708081304.WAA11611@tera.fukui-med.ac.jp> Date: Fri, 8 Aug 1997 22:04:31 +0900 (JST) From: Tatoku Ogaito <tacha@tera.fukui-med.ac.jp> Reply-To: tacha@tera.fukui-med.ac.jp To: netbsd-bugs@netbsd.org Cc: current-users@netbsd.org Subject: this is just example
will convert to
Message-Id: <199708081304.WAA11611@tera.fukui-med.ac.jp> Date: Fri, 8 Aug 1997 22:04:31 +0900 (JST) From: Tatoku Ogaito <tacha@tera.fukui-med.ac.jp> Reply-To: tacha@tera.fukui-med.ac.jp To: netbsd-bugs@netbsd.org Cc: current-users@netbsd.org Subject: this is just example Newsgroups: netbsd.bugs,netbsd.current
Since
mail2news use original mail's message-id as news message-id,
nnrpd(8) refuse to accept same mail through different mailing list.
In that case,
mail2news just ignore the error and unlink temporary files since it should
be cross posted.
| /var/tmp/mn_XXXXX/mail | Original Mail file. |
| /var/tmp/mn_XXXXX/news | Converted file. |
| /var/tmp/mn_XXXXX/err | Error output of while execution. |
| mailtonews.conf | conversion table from Mailing list name to newsgroup. |
Although
mail2news converts Message-Id based on own rule, it does not care about
Reference: field.
innd(8), newstomail(1)
Originally
mail2news was appeared as
mailtonews in OLNS Software.
| TERA | January 13, 1998 | Exp |