The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

mailtonews

Performs a variety of rewrites, changes, and checks necessary to do the basic conversion of a mail message into a news message. Most of this involves deleting or renaming headers that a news server will not accept or would overwrite and making sure that the required news headers are present.

This module does the following: Checks to ensure there is a From header; compacts the From header down to one line if it contained any continuation lines since INN can't deal with continuation lines in a From header; adds a Newsgroups header with the default group if none is present, or checks the Newsgroups header for validity and removes duplicate groups if one is present; drop the headers Lines, Received, Relay-Version, and Xref which will be rejected or overwritten by the news server; renames the headers NNTP-Posting-Host and Sender to be prefixed with X-Original- since new ones will be generated; adds a new Sender header pointing to the maintainer (set in the News::Gateway constructor); renames the Message-ID header to X-Original-Message-ID if the message ID is syntactically invalid for a news message (this will cause a new message ID to be generated by the server); checks the In-Reply-To header if present to see if it contains something that looks like a message ID and if so adds it to the end of the References header if and only if it doesn't duplicate the message ID on the end of the References header; and sets the subject of the article to the value "(none)" if there is no Subject header.

This module takes one argument, the default newsgroup to post to. A Newsgroups header containing this group will be added if no Newsgroups header is present in the incoming message. This argument is optional, but if you're gating mail messages to news messages you'll pretty much always want to supply it. While it's tempting to assume that all submissions to a moderated group will already have a Newsgroups header added by the news server, you'll find in practice that people will often mail submissions directly to the submission address, or that news servers won't handle things in the way that you would expect.

This module (possibly combined with the headers module) may be sufficient for generating the Newsgroups header if the program only handles one newsgroup, but any more complicated situation will probably require that a module (such as the newsgroups module) be run before this one to generate the Newsgroups header.

There are three possible failure messages which may be returned;

Empty body

The body of the message was empty. Most news servers will reject messages with an empty body.

Missing required From header

The incoming message doesn't have a From header. A From header is required for all messages.

No Newsgroups header or default group

The incoming message didn't have a Newsgroups header and no argument was supplied to the module. If you don't supply an argument specifying the default newsgroup, all incoming messages must have a Newsgroups header before this module is run, since a Newsgroups header is mandatory in a news article.

This module takes no configuration directives.