MAILPOST(8)

NAME
mailpost - Feed an e-mail message into a newsgroup

SYNOPSIS
mailpost [-hn] [-a addr] [-b database] [-c wait-time] [-d distribution] [-f addr] [-m mailing-list] [-o output-command] [-p port] [-r addr] [-t tempdir] [-x header[:header...]] [-z header[:header...]] newsgroups

DESCRIPTION
The mailpost program reads a properly formatted e-mail message from stdin and feeds it to inews for posting to a news server. newsgroups is a whitespace-separated list of group names to which to post the article (at least one newsgroup must be specified).

Before feeding the article to inews, it checks that the article has not been seen before, and it changes some header fields (cleaning up some address header fields, removing a few ones like X-Complaints-To and X-Trace, and putting "X-" in front of unknown header fields). The Received and *-To header fields are also altered to prevent spamming the gateway (the name of the news server or the domain name set in fromhost, pathhost and domain in inn.conf are removed).

If the article has been seen before (mailpost records the message-ID of each article it handles), then the article will be dropped with a non-zero error status. Other errors will cause the article to be mailed to the newsmaster (selected at configure time and defaulting to "usenet").

Normally, mailpost is run by sendmail(8) via an alias entry:

    local-mail-wreck-bikes: "|<pathbin in inn.conf>/mailpost
        -b /var/spool/mailpost -t /tmp -d local local.bicycles.racing"

The -b and -t flags are useful to change the directories used by mailpost by default. As a matter of fact, though it is recommended to run mailpost as the news user, it is as often as not run as another user, notably the mail user. Therefore, you should make sure to create and set to be writable by the user that mailpost runs as the directories where to put the database and the temporary files. Also, mailpost must be executable by that user.

Instead of /var/spool/mailpost, the mail spool directory can be specified, or any other directory where the mailpost process has write access.

A common practice to gateway a newsgroup to a mailing-list is to create a moderated newsgroup (running for instance the command "ctlinnd newgroup local.bicycles.racing m") and set the moderation address for this newsgroup in the moderators file in pathetc to the mailing-list address. If you add an -a flag in the above example, then on the one hand, when a message is sent to the mailing-list, mailpost will be run, mark it as approved, and the message will directly reach the newsgroup. On the other hand, when a message is posted to the newsgroup, it normally does not have an Approved header field, so it will be sent (by nnrpd) to the mailing-list address configured in the moderators file, which means the message reaches the mailing-list and, like any other messages posted to the mailing-list, it will be processed by mailpost, approved, and finally reach the newsgroup.

OPTIONS

-a addr
    If the -a flag is used, addr (which is usually the e-mail address of the poster) is added to the article as the body of an Approved header field. It is useful if one of the newsgroup to which the article should be posted is moderated. (Of course, this flag should be added only if you are supposed to auto-approve your posts.)

    Be sure that the reader connection made by inews to post the article is allowed to post approved articles (see the "A" letter in the access parameter of access blocks in readers.conf).

-b database
    If the -b flag is used, then it defines the location of the persistent database used to store the message-IDs of articles sent on. This is to prevent articles looping around if a news-to-mail gateway sends them back here. This option may be required if the mailpost process does not have write access to the news database directory (notably when it is executed as the mail user). The default value is pathdb as set in inn.conf.

    Make sure the specified location exists and is writable by the user mailpost runs as.

-c wait-time
    The -c flag indicates a length of time to sleep before posting. If duplicate messages are received in this interval (by any instance of mailpost using the same database), the article is only posted once, but with Newsgroups: header modified to crosspost the article to all indicated groups. The units for wait-time are seconds; a reasonable value may be anywhere from tens to hundreds of seconds, or even higher, depending on how long mail can be delayed on its way to your system.

-d distribution
    If the -d flag is used, the value given is added to the article as the body of the Distribution header field.

-f addr
    The -f flag is a synonym for the -r flag.

-h  Print usage information and exit.

-m mailing-list
    If the -m flag is used, the value given is added to the article in a Mailing-List: header, if such a header doesn't already exist.

-n  If the -n flag is used, neither an article is posted nor a mail is sent in case an error occurs. Everything is written to the standard output.

-o output-command
    Specifies the program to which the resulting article processed by mailpost should be sent. For debugging purpose, "-o cat" can be used. The default value is "inews -S -h".

-p port
    Specifies the port on which nnrpd is listening, used for article posting. If given, -p is passed along to inews.

-r addr
    A heuristic is used to determine a reasonable value for the Path: header. The -r flag indicates what to use if no other value can be determined.

-t tempdir
    If the -t flag is used, then it defines the location of the directory to use to temporarily store error messages that are sent to the newsmaster. This option may be required if the default value refers to a path that does not exist or the mailpost process does not have write access to (notably when it is executed as the mail user). Two paths are tried by default: pathtmp as set in inn.conf, and then /var/tmp if pathtmp is not writable.

    Make sure the specified location exists and is writable by the user mailpost runs as.

-x header[:header...]
    A colon-separated list of additional header fields which should be treated as known header fields; these header fields will be passed through to inews without having "X-" prepended.

    By default, known header fields are:

        Archive
        Archived-At
        Comments
        Content-*
        Date
        Distribution
        From
        Injection-Date
        Keywords
        Mailing-List
        Message-ID
        MIME-*
        Organization
        References
        Return-Path
        Sender
        Subject
        Summary

-z header[:header...]
    A colon-separated list of additional header fields which should be removed.

    By default, removed header fields are:

        X-Complaints-To
        X-Trace

FILES

pathbin/mailpost
    The Perl script itself used to feed an e-mail message to a newsgroup.

pathdb/mailpost-msgid.dir and pathdb/mailpost-msgid.pag
    The default database files which record previously seen message-IDs.

HISTORY
Written by Paul Vixie long ago and then hacked up by James Brister for INN integration. Documentation improved by Julien Elie.

SEE ALSO
inews(1), inn.conf(5), libinn_uwildmat(3), moderators(5), nnrpd(8), readers.conf(5).