 |
| Introduction |
|
xm2nntp is a mail to nntp gateway script written in PERL primarily for use with the mailproc
feature of XMail Server. It provides XMail with means to relay/forward incoming
messages to newsgroup(s) based on the sender address with nods to mailing-lists or
similar, suited for newsgroup style archiving.
xm2nntp keeps track of message-references where present and automatically
converts them to equivalent nntp style discussion threads.
|
| |
|
As of version 2 multiple gatewaying rules for an unlimited number of accounts can
be configured. An optional per rule setting also allows you to de-multipart and strip off
attachments before relaying messages.
|
| |
|
xm2nntp is free software, distributed under the terms of the
GNU General Public License.
|
| |
 |
| Requirements |
- XMail Server
(preferrably version 1.9 or higher)
- PERL (with the MIME-Tools package installed)
- An NNTP server available for posting
|
| |
 |
| Installing the PERL MIME-Tools package |
Unless you are familiar with manually installing PERL modules, I suggest you use the CPAN module
(UNIX/Linux) or for Win32 users, PPM (PERL Package Manager), for a non-hazzle installation.
- PPM (for Windows users)
In a DOS shell prompt and issue: ppm install MIME-Tools
- CPAN
$ perl -MCPAN -e "install MIME::Tools"
|
| |
 |
| Installing and Configuring |
|
Installing xm2nntp on your box assumes you already have the pre-requisite software such as PERL
and XMail up and running. Unlike most other contributed mail-processing programs available for Xmail, xm2nntp
is not a filter. It is instead invoked as an external mailproc process. Since xm2nntp just wants a copy
of the message and has no intentions of feeding the message back to XMail, a filter approach isn't applicable.
Once xm2nntp gets a copy of the message, it does the job in the background, detached from the real message processing.
So if you haven't already, you might need to read up on the mailproc feature in the
Xmail documentation.
Further, these instruction assumes the xm2nntp.pl script is located in the [MAIL_ROOT]/bin directory.
|
| |
 |
| The mailproc.tab |
Any real Xmail user account (as opposite to cmdalias and custdomains ***) acknowledges an mailproc.tab
in a user directory for additional custom processing of incoming messages. xm2nntp is invoked
with the external command as follows:
"external"[TAB]"-1"[TAB]"0"[TAB]"/path/to/perl"[TAB]\ "/mailroot/bin/xm2nntp.pl"[TAB]"@@FROM"[TAB]"@@TMPFILE"[NEWLINE]
|
| |
|
...where [TAB] is to be substituted with the dreaded tab character(\t).
Modify the paths to the PERL executable and the xm2nntp.pl script.
Also NOTICE that @@TMPFILE is used here rather than @@FILE,
since xm2nntp does its own cleaning up and does not rely on XMail for this.
You might also want to add the mailbox command
if you still want the messages delivered to your mailbox.
|
| |
|
There is a mailproc.tab template bundled with the download that you can modify to suit your
needs. Once you have the above directives defined you can simply copy it as-is to any
user directory which for you need gatewaying to take place, if the sender of the message matches
a defined rule that is... read on...
|
| |
|
*** Theoretically xm2nntp could be used with the cmdalias and customdomain features of XMail,
but I haven't gotten around to test such a setup yet.
|
| |
 |
| Configuring xm2nntp.pl |
There are basically two things you need to modify inside the script
before your copy of XMail will perform NNTP gatewaying.
Open up xm2nntp.pl in your favorite text-editor and scroll down to the
USER DEFINABLES section and make the appropiate
additions according the instructions below.
- The gatewaying rules (%GATEWAY_MAP)
- Headers marked for removal (@MSG_HEADER_REMOVE)
|
| |
|
The gateway rules are defined in a hash-table named %GATEWAY_MAP, where the sender
address act as the identifier key and the key-value an array defining
the NNTP-server, username/password (if applicable) and target newsgroups.
|
| |
|
The key reflects part of/a full sender address of a message that should be
gatewayed. xm2nntp will make a substring match for each key against the incoming sender address
to determine if the message should be processed or not. If no match is found, xm2nntp
cleanups the tempfile and exits right away without further processing.
If you want to relay all messages from a specific sending domain you leave out the username
part. Further, "-list@bogus.tld" will relay anything matching a
sender address like "foo-list@bogus.tld" or "bar-list@bogus.tld",
but not "baz@bogus.tld". Escape the at character (@) to keep PERL happy.
|
| |
The key-values are defined as arrays and holds information about news-server
name or IP-address, login information, whether messages are to be mangled into
singlepart and stripped from attachments and target newsgroup(s).
The information is defined in the following order:
- NNTP-server (name or IP-address, port 199 is assumed)
- username
- password
- force singlepart (integer or string) [1|0]
- ...newsgroup or newsgroups...
I will not go into this further, please refer to inline examples to set
up your own gatewaying rule. Its very easy, I promise you...
|
| |
 |
| Testing your setup |
While setting up xm2nntp you may use any public *.test group as target in
case you don't have an NNTP server under your command. These groups are
there for purposes like this.
(suggestion: news://news.mozilla.org/netscape.test)
|
| |
| |