I wrote a script that let's you insert an archived newsgroup or mailing list into the usenet tables. I wrote it so that I could import all the messages since the newsgroup was created and so that I could feed the new messages in from two sources, the mailing list and the newsgroup. Feeding it in from the two sources, I hope will eliminate my missing posts problem for the ones that don't make it into the newsgroup.
This script will read mail in from a file or from an email alias and then parses it to be included in the database. Then the messages will be inserted with the newnews.pl script provided in the Usenet Gateway hack. This script does not make use of any of the spam/binary filtering or other replacement strings that occur before it's inserted.
How to use this script:
From the command line, execute the script like:
Code:
./mail2forum.pl < filename2messages.txt
That will insert all the messages in the text file into the database. The text file needs to conform to the mail standards, so it's the same format as the sendmail spool files and the same as what many other email programs use. (Basicly, the beginning of a message is signified by a line beginning with "From " followed by the headers, then an empty line, and then the body).
This script can also be used to insert a message sent to an email address right into the database. To do this, you'll need to create an alias in the sendmail aliases (usually at /etc/aliases) to execute the script. The alias would look like this:
Code:
forum: "|/path/to/mail2forum.pl"
Most systems are set up so that not just any script can be executed by sendmail for security reasons. Usually, you'll need to create a symbolic link to the file in a special directory (as root). In the systems I've used, this directory has been "/etc/smrsh/" or "/usr/adm/sm.bin/".
You'll need to rename the file to have the .pl extension.