













                                        Mail2Dir

                                       User Guide




         Mail2Dir

         Move mail to spool directory

         User Guide

         Copyright 1998 Definite Solutions HB; All rights reserved.



         All Definite Solutions products and trademarks are trademarks or
         registered trademarks of Definite Solutions HB; with the exception
         of FrontDoor, which is a registered trademark of Joaquim
         Homrighausen. Other brands and product names are trademarks or
         registered trademarks of their respective holders.



          This publication is protected by international copyright laws and
              treaty provisions. It may only be distributed and used in
                  accordance with those laws and treaty provisions.



         DEF-E-MAIL2DIR-Z-980100-EP

         Produced in Sweden.


     Mail2Dir                                                  User Guide

       TABLE OF CONTENTS


         Table of contents                                   3


         1. Introduction                                     4

           1.1 Legal notice                                  4
           1.2 What is Mail2Dir?                             4
           1.3 Requirements                                  4
           1.4 Operating system versions                     5

         2. Program usage                                    6

           2.1 Installation                                  6
           2.2 Command line format                           6
           2.3 Command file                                  8
           2.4 Errorlevels                                  10

         3. Messages and routing                            11

           3.1 Routing commands                             11
           3.2 Message status                               12

         Appendix A: Macros                                 13


         Appendix B: Version history                        14

           B.1 Mail2Dir 1.10                                14
           B.2 Mail2Dir 1.00                                14

         Appendix C: Contact information                    15


         Index                                              16
















     Table of contents                                             Page 3


     Mail2Dir                                                  User Guide

       1. INTRODUCTION


       1.1 LEGAL NOTICE

         Mail2Dir is provided to you "as is", without warranties of any kind.
         In no event shall Definite Solutions HB be liable to you or anyone
         else for any damages or costs arising from the use or inability to
         use this program.

         Mail2Dir is protected by copyright laws, and may not be modified,
         reversed engineered, sold or distributed in any way that would
         involve some sort of trade, without written permission from Definite
         Solutions HB.

         Mail2Dir may be used without charge by anyone that is running a
         registered copy of the shareware version of FrontDoor, or the
         commercial version of FrontDoor.

         Mail2Dir may also be used during the 30-day trial/evaluation period
         of the shareware version of FrontDoor. After this period, FrontDoor
         must be registered if you want to continue using this program (or
         FrontDoor).


       1.2 WHAT IS MAIL2DIR?

         Mail2Dir is a utility that can be used together with the FrontDoor
         mailer, "FD" hereafter.

         What it does:

         o Mail2Dir moves all messages and files that are addressed to
           certain systems to specified directories. It can for instance be
           used to move mail for a point over a LAN, or to move mail for
           systems that wish to pick it up via FTP.

         o Mail2Dir scans FD's netmail directory and static queue to find
           the mail and files that are waiting to be sent to the specified
           systems. When doing this, it honors all the flags and attributes
           that FD uses.

         o Mail2Dir is fully integrated with FD, and it reads FD's
           configuration files to get the necessary information. It also uses
           FD's semaphore files to prevent any problems.

       * The term FD 2.25+ in this document refers to version 2.25 and above
         of FD.


       1.3 REQUIREMENTS

         Mail2Dir requires the following to run:


     Introduction                                                  Page 4


     Mail2Dir                                                  User Guide

         o FD version 2.11 or later

         o The environment variable FD pointing to the directory where
           SETUP.FD is located, or SETUP.FD in the current directory

         o For multiline users, the environment variable TASK containing the
           task number.

         Message and queue entry requirements:

         o Mail2Dir will always ignore all messages or queue entries with
           Sent, Received or Locked status. It will also ignore those with
           File Request status, since it would not be possible to perform a
           file request by this method.

         o By default, Mail2Dir will also ignore all messages that have
           Crash, Immediate or FPU status (if the message has been created
           locally, i.e. has Local status). For messages that are not create
           locally (i.e. the Local flag is missing), the Crash, Immediate and
           FPU flags are ignored.

         o When processing the static queue, Mail2Dir will process the
           entries that either are File or Spool entries. Entries that are
           Deleted, Locked, or have the NoPickup status will be ignored.

       * Even if this program works with versions of FD before 2.25, the
         static queue that is mentioned in this document only exists in
         version 2.25+.


       1.4 OPERATING SYSTEM VERSIONS

         Mail2Dir comes in three different versions, one version for DOS,
         another one for OS/2 2.x and Warp, and one for Win32 (Windows 95 and
         NT) console mode. This document uses the name M2D.EXE to refer to
         all of these versions; the actual filenames are:

          DOS     M2D.EXE
          OS/2    M2D2.EXE
          Win32   M2DW32.EXE


         If you are using the OS/2 or Win32 version, please replace any
         references to M2D.EXE with the correct name above.










     Introduction                                                  Page 5


     Mail2Dir                                                  User Guide

       2. PROGRAM USAGE


       2.1 INSTALLATION

         To install Mail2Dir, copy the file M2D.EXE to a directory.

         You can also optionally create a routing file for Mail2Dir, which
         should be called ROUTE.M2D and located in FD's SYSTEM directory.


       2.2 COMMAND LINE FORMAT

         To use Mail2Dir, run the program and specify some command line
         parameters. If you run the program without any parameters, a help
         message is displayed.

         The format of the command line for Mail2Dir is:


         M2D [switches] <Dir> <Address1> [<Address2> [...]]

         You can use macros anywhere on the command line if you wish. See
         Macros below for more information.


       2.2.1 Parameters


       2.2.1.1 switches

         This parameter can be one or more of the switches listed below.

         All switches can be abbreviated to the shortest unique name, which
         is the uppercase part of the name in the list. You can use either a
         / (slash) or a - (dash) in front of each switch.


       2.2.1.2 <Dir>

         This parameter is the directory to which Mail2Dir should move all
         messages and files for the systems specified with the <Address?>
         parameters.


       2.2.1.3 <Address1>, <Address2>, ...

         These parameters are used to specify up to 10 addresses. Mail2Dir
         will move all messages and files addressed to one of these addresses
         to the <Dir> directory.





     Program usage                                                 Page 6


     Mail2Dir                                                  User Guide

       2.2.2 Switches


       2.2.2.1 /Crashok

         Use this switch if you want Mail2Dir to process messages and queue
         entries that have Crash or Immediate status.


       2.2.2.2 /IFExist=mask

         Mail2Dir will only process mail for the specified systems if a file
         that matches the specified mask exists, otherwise mail for these
         systems are skipped.


       2.2.2.3 /IFNotexist=mask

         Mail2Dir will only process mail for the specified systems if there
         is no file that matches the specified mask, if there is a matching
         file, mail for the specified systems are skipped.


       2.2.2.4 /Killempty

         Empty netmail messages will not be packed into a .PKT file, they
         will just be deleted (or marked as Sent). If files are attached to
         the message, they will be moved to the specified directory.


       2.2.2.5 /NOLOCkmissing

         By default, Mail2Dir will lock a message or static queue entry that
         has a file attached, if the attached file is missing when Mail2Dir
         attempts to copy the file to the destination directory. This
         prevents the same message/static queue entry from being processed
         repeatedly, and creates an indication for the system operator that
         something is wrong. To disable the default behavior, use this
         switch.


       2.2.2.6 /CMdfile=file

         If you want Mail2Dir to process mail for many systems at once, you
         can use a text file with commands. See "Command file" below for more
         information.


       2.2.2.7 /Logfile=file

         By default, Mail2Dir writes information to the MAIL2DIR.LOG file in
         the same directory as FD's logfile. Use this switch if you want
         Mail2Dir to write the log information to another file.


     Program usage                                                 Page 7


     Mail2Dir                                                  User Guide

       2.2.2.8 /NOLOGfile

         Use this switch if you do not want any logfile at all.


       2.2.2.9 /Usefdlog

         Use this switch if you want Mail2Dir to use the same logfile as FD.
         The name of the logfile will be read from FD's configuration.


       2.3 COMMAND FILE

         Instead of specifying all information on the command line each time
         you run Mail2Dir, it is possible to use a text file that contains
         all the commands.

         The command file has the advantage that you can specify that
         Mail2Dir should process messages and queue entries for more than one
         system at once, and therefor reduce the number of times you have to
         run Mail2Dir.

         The file is a standard text file, which can contain empty lines and
         comments. Comments can occur anywhere in the file, and should start
         with a semicolon (;).

         Each line in the file should contain a complete definition for which
         systems' mail that should be moved, and to where it should be moved.
         The lines should have exactly the same format as the command line
         (see above), with the exception that they should not begin with
         Mail2Dir (i.e. the program name).





















     Program usage                                                 Page 8


     Mail2Dir                                                  User Guide

         You can use macros anywhere on the lines in the command file if you
         wish. See Macros below for more information.

         A few things to think about when using a command file:

         o Switches specified on the command line together with the /CmdFile
           switch are default for all lines in the command file. It is
           however not possible to specify a <Dir> or a <Address?> parameter
           on the command line, together with the /CmdFile switch.

         o You can not use the /LogFile, /NoLogFile, /UseFDLog or /CmdFile
           switches in the command file. If you do, they will just be
           ignored.

         o If you use the /IfExist or the /IfNotExist switch in the command
           file, they only apply to the systems specified on the same line.

         o If you use the /IfExist or the /IfNotExist switch on the command
           line together with the /CmdFile switch, the file masks are checked
           for all systems in the command file.


       2.3.1 Examples of a command file

         To clarify how the command file works, here is an example of one:


         C:\OUT\MYPOINT    2:270/19.1 255:3352/3 /CrashOk
         X:\FILE\FTP\MATS  2:201/329 /IfNotExist=X:\FILE\FTP\MATS\*.BSY
         X:\FILE\FTP\BRUCE 1:170/400 /IfExist=Y:\SEMAPHOR\GETMAIL.NOW

         The three lines above will tell Mail2Dir to do the following:

         o Copy all mail and files that are addressed to 2:270/19.1 and
           255:3352/3 to the C:\OUT\MYPOINT\ directory, including messages
           and files that have Crash or Immediate status.

         o Copy all mail to 2:201/329 to the X:\FILE\FTP\MATS\ directory,
           but only if there are no file with the extension .BSY in the
           X:\FILE\FTP\MATS\ directory.

         o Copy all mail to 1:170/400 to the X:\FILE\FTP\BRUCE\ directory,
           but only if there is a file with the name GETMAIL.NOW in the
           Y:\SEMAPHOR\ directory.

         If the command file above is named MAIL2DIR.CMD, it can be used with
         the following command:







     Program usage                                                 Page 9


     Mail2Dir                                                  User Guide

         M2D /CmdFile=MAIL2DIR.CMD


       2.4 ERRORLEVELS

         Mail2Dir exists with errorlevel 0 if there was nothing to do, and
         with errorlevel 1 if it has moved any messages or files.

         Any other errorlevel indicates an error.







































     Program usage                                                Page 10


     Mail2Dir                                                  User Guide

       3. MESSAGES AND ROUTING

         By default, Mail2Dir only processes messages that are addressed to
         one of the addresses that you specify on the command line or command
         file. However, it is possible to route messages (with or without
         files attached). To do this, a file named ROUTE.M2D should be
         located in FD's system directory.

         The ROUTE.M2D file is similar to the ROUTE.FD file that FD uses,
         however, only a subset of the commands that FD allows are supported
         by Mail2Dir. The following commands can be used:

         For a more thorough documentation of these routing commands, please
         see the FD documentation.

       * You can use the program FDROPT to create the file ROUTE.M2D.


       3.1 ROUTING COMMANDS


       3.1.1 ROUTE-TO <target> <address-list>

         This command specifies that messages (with or without files
         attached) addressed to a system in <address-list> will be sent via
         <target>.


       3.1.2 ROUTE-FILES <target> <address-list>

         Identical to the ROUTE-TO command described above.


       3.1.3 NO-ROUTE <address-list>

         This command specifies that messages (with or without files
         attached) addressed to a system in <address-list> will be sent
         directly to that system.

         Special consideration is taken by Mail2Dir when interpreting the NO-
         ROUTE command in regards to points. Unless an explicit point address
         is specified, Mail2Dir will send messages to a point via the
         server/boss system.


       3.1.4 DIRECT <address-list>

         Identical to the NO-ROUTE command described above.


       3.1.5 EXCEPT <address-list>

         The EXCEPT command is used to specify an exception to the previously
         used <address-list>, i.e. to exclude one or more systems from the
         list.

     Messages and routing                                         Page 11


     Mail2Dir                                                  User Guide

       * Using one of these routing commands only tells Mail2Dir to which
         system a message should be sent, IF IT IS PROCESSED. For a message
         to be processed, the destination system has to be specified on
         either the command line or in the command file specified with
         /CMDFILE. It is not sufficient to only list a system in the
         ROUTE.M2D file.


       3.2 MESSAGE STATUS

         Mail2Dir does not differentiate between normal messages and messages
         with files attached to them. All messages are treated the same.

         A message with one of the Crash, Immediate, Hold, Direct or FPU
         flags is never affected by routing, and neither is an entry in the
         static queue.

         Mail2Dir supports KFS, TFS, KFS! and TFS! status. Any queue entry
         with KFS! or TFS! status is processed immediately after the file has
         been copied, so that the original file is deleted or truncated. For
         queue entries or netmail file attaches with the KFS or TFS flags,
         Mail2Dir processes these after all files have been copied. If there
         are no remaining file attaches or queue entries for a file that has
         been copied, the file is deleted or truncated, depending on the KFS
         and TFS flag.


























     Messages and routing                                         Page 12


     Mail2Dir                                                  User Guide

       APPENDIX A: MACROS

         A few macros can be used with Mail2Dir, both on the command line,
         and in the command file. These macros could for instance be useful
         if you want to have one logfile per day.

         Macros are used in the same way as you use macros in FDSETUP, i.e.
         $[name].

         The following macros are supported:

          Macro   Description
          YYYY    The current year, 4 digits
          YY      The current year, 2 digits
          MM      The current month, 2 digits
          DD      The current day, 2 digits
          WW      The number of the current weekday, 1 digit
                  (0  Sunday, 1  Monday, ..., 6  Saturday)
          WDAY    The name of the current weekday, 3 characters
                  (SUN, MON, ..., SAT)


         If the macro you specified is not one of these, Mail2Dir checks if
         there is an environment variable with this name, and if there is,
         uses the value of the environment variable.

         An example of a command line that uses these macros is:


         M2D /LogFile=M2D-$[MM]$[DD].LOG C:\DESTDIR 2:201/329

         This would tell Mail2Dir to use a logfile that contains the month
         and day number.



















     Macros                                                       Page 13


     Mail2Dir                                                  User Guide

       APPENDIX B: VERSION HISTORY


       B.1 MAIL2DIR 1.10


       B.1.1 New feature:

         Added OS/2 and Win32 versions of the program.

         Added support for FD 2.25+.

         Messages and queue entries with a non-existing file attached are now
         locked by default.

         Added routing possibilities. (See "Messages and routing" above).

         Added switch /NoLockMissing. (See "/NOLOCkmissing" above).

         Added switch /Killempty. (See "/Killempty" above).


       B.1.2 Changes:

         Messages from one of the addresses defined in SETUP.FD will no
         longer be processed if the message does not have Local status.


       B.1.3 Bug fixes:

         Mail2Dir did not complain when it processed a static queue entry
         that pointed to a non-existing file.

         There were a few situations when Mail2Dir would insert the wrong
         filename in the subject line of the message after copying the file
         to a different name.


       B.2 MAIL2DIR 1.00

         Initial version












     Version history                                              Page 14


     Mail2Dir                                                  User Guide

       APPENDIX C: CONTACT INFORMATION

         Definite Solutions can be reached at:

          Postal address:   Definite Solutions HB
                            Frskottsvgen 11
                            S-129 32  Hgersten
                            SWEDEN

               Telephone:   +46 8 6456495       (0800-1800 CET, Mon-Fri)

                     Fax:   +46 8 55630102

                     BBS:   +46 8 55630102      (V.34 8N1, X.75 ISDN)
                            +46 8 55630103      (V.34 8N1, X.75 ISDN)

                 FidoNet:   2:201/329
                            2:201/330

                Internet:   sales@defsol.se
                            http://www.defsol.se/


        Please refer to our website (above) for additional information such
        as the FrontDoor Developer's Kit (FDDEV), the FrontDoor Frequently
        Asked Questions (FDFAQ) document, and more.

























     Contact information                                          Page 15


     Mail2Dir                                                  User Guide

       INDEX


        A

         Acrobat Reader                                      4

        C

         Command file                                        8
         Command line                                        6
         Contact information                                15

        D

         Definite Solutions                                 15
         DIRECT                           See Routing commands

        E

         Errorlevels                                        10
         EXCEPT                           See Routing commands

        F

         Filenames                                           5

        I

         Installation                                        6

        L

         Legal notice                                        4

        M

         Message status                                     12

        N

         NO-ROUTE                         See Routing commands

        O

         Operating system versions                           5

        P

         Parameters                                          6

        R

         Requirements                                        4
         ROUTE-FILES                      See Routing commands

     Index                                                        Page 16


     Mail2Dir                                                  User Guide

         ROUTE-TO                         See Routing commands
         Routing commands
           DIRECT                                           11
           EXCEPT                                           11
           NO-ROUTE                                         11
           ROUTE-FILES                                      11
           ROUTE-TO                                         11

        S

         Switches
           /CmdFile                                          7
           /CrashOk                                          7
           /IfExist                                          7
           /IfNotExist                                       7
           /KillEmpty                                        7
           /LogFile                                          7
           /NoLockMissing                                    7
           /NoLogFile                                        8
           /UseFDLog                                         8

        V

         Version history                                    14
           Mail2Dir 1.00                                    14
           Mail2Dir 1.10                                    14

























     Index                                                        Page 17
