===== Magimail configuration =====

Magimail is a fork of Crashmail-II and is configured using a `magimail.prefs`
file in the working directory that you call magimail from. I usually put my
prefs file in the `MagickaBBS/ftn/` directory.

==== Example magimail.prefs file ====

Here is a sample template you can use to get started configuring magimail,
along with explainations for each command. Please note there are many more
commands you can use for more advanced setup. The full documentation is in

    SYSOP "Your Name"
    BBSNAME "Some BBS"

    LOGFILE "/path/to/MagickaBBS/logs/magimail.log"

    DUPEFILE "/path/to/MagickaBBS/ftn/dupes.log" 200




    INBOUND "/path/to/MagickaBBS/ftn/in_sec"
    OUTBOUND "/path/to/MagickaBBS/ftn/out"
    TEMPDIR "/path/to/MagickaBBS/ftn/cm_temp"
    CREATEPKTDIR "/path/to/MagickaBBS/ftn/cm_temp"
    PACKETDIR "/path/to/MagickaBBS/ftn/cm_packets"
    STATSFILE "/path/to/MagickaBBS/ftn/magimail.stats"

    GROUPNAME A "happynet"

    PACKER "ZIP" "zip -j %a %f" "unzip -j %a" "PK"

    AKA 637:1/999
    DOMAIN happynet


    ROUTE "637:*/*.*" "637:1/100.0" 637:1/999


    NETMAIL "NETMAIL" 637:1/999 JAM "/path/to/MagickaBBS/msgs/hpy_netmail"

    AREA "BAD" 637:1/999 JAM "/path/to/MagickaBBS/msgs/bad"

    AREA "DEFAULT_A" 637:1/999 JAM "/path/to/MagickaBBS/msgs/%l"

    AREA "HPY_GEN" 637:1/999.0 JAM "/path/to/MagickaBBS/msgs/hpy_gen"
    EXPORT %637:1/100.0

==== General Configuration ====


This is your name


This is the name of your BBS


The file to use as a log.


The amount of verbosity to use, 3 is normal, 1 is minimal and 6 is debug mode.


The name of the DUPE file, and the number of messages to store.


This can be **BAD** for moving dupes to a BAD area (defined later) **KILL** to
kill them or **IGNORE** to pass them.


When magimail encounters a netmail stuck in a loop it can, **LOG** it,
**LOG+BAD** log it and send it to the **BAD** area, or IGNORE it.


The maximum size of a packet before magimail creates a new packet. In KB.


The maximum size of a bundle of packets, In KB.


This is the default zone, if magimail can't figure out the zone any other way,
it uses this.


The directory magimail looks for packets and bundles to toss.


The directory magimail writes flow files that tells binkd what files to send.


The directory magimail unpacks incoming bundles.


Packets are created in this directory before they are moved to the 


This directory is where magimail stores bundles.


This file stores stats about the usage of magimail. You can view the stats
with the magistats utility.


Magimail should add an INTL line to netmails even if the sender and recipient
are in the same zone.


Magimail will honour recipt requests.


Magimail will honour audit requests.


Magimail should never send a message to a node in the SEEN-BY lines.


Import magimail's areafix into the netmail area.


Import seen-by lines.


Name bundles according to the weekday they were created.


Add a TID line to all messages exported by magimail.


Allow nodes to rescan areas with Areafix.


Include all forward-requestable areas in the area listsgenerated by the


Magimail will delete netmails that have the KILLSENT flag after they have
been exported.

==== Group Names ====

These are description for groups for use by areafix, there can be multiple


This is the letter for the group and a description in quotation marks.

==== Packers ====

Here you configure the external packers that Magimail uses. %a stands for
archive name and %f stands for file name. The recog string is used when 
Magimail detects the packer used to pack a bundle. If the beginning of the
bundle matches the recog string, Magimail uses that packer. ? can be used
as a wildcard and you can use $xx to specify a hexadecimal number.


[name] [pack command] [unpack command] [recog]

==== AKA ====

You can have multiple AKAs, these are your addresses given to you by networks.


A network address


The domain for the network.

==== Nodes ====

You should configure a node section for every node you export packets to, in a
typical setup, there will only be one for your hub.


[address] [packer] [packet password] [flags] Flags in the exampleconfig are
**AUTOADD** to automatically add areas you receive mail for, and
**PACKNETMAIL** to pack netmail along with the echomail.


The default group this node has access to.

==== Routing ====

Netmails who's destination matches a pattern are routed to destination pattern
using the specified AKA


[pattern] [destination pattern] [aka]

==== JAM Configuration Options ====


Use a highwater mark to speed up scanning.


Do reply-linking based on MSGID and REPLY after import.


Just compare the CRC of MSGID/REPLY when linking and don't read the strings
from the messagebase. This makes linking quicker, but messages that don't
match may be linked by mistake.


The maximum number of JAM areas opened at one time.

==== Areas ====


[tagname] [aka] [messagebase] [path]

message base can be JAM or SQ3, JAM is recommended.


Nodes to export to.


The letter of the group this area is in.

==== Example magitoss.sh ====

    cd /path/to/MagickaBBS/ftn
    ../utils/magimail/bin/magimail toss

==== Example magiscan.sh ====

    cd /path/to/MagickaBBS/ftn
    ../utils/magimail/bin/magimail scan

==== Watching for New Mail ====

When new mail is created on your bbs, a semaphore file is touched. So, you
need to run a script that watches for changed semaphores and runs

On Linux and FreeBSD this can be accomplished with inotifytools. On other
platforms, an alternative called FSWatch 
(https://github.com/emcrisostomo/fswatch) is available.

==== Example watchmail.sh (inotifytools) ====

    cd /path/to/MagickaBBS

    touch mail.out

    while inotifywait -e close_write mail.out; do ./ftn/magiscan.sh;done

==== Example watchmail.sh (fswatch) ====


    touch /path/to/MagickaBBS/mail.out
    /usr/local/bin/fswatch -o /path/to/MagickaBBS/mail.out | xargs -n1 -I{} /path/to/MagickaBBS/ftn/magiscan.sh