Example 3
NTMail with a Small LAN and Dial-Up Internet Access

It is increasingly common for an individual or small LAN to have a part-time (dial-up) connection to the Internet. A stand-alone router, such as the Ascend Pipeline 50, can be used to connect an Ethernet LAN to an Internet Service Provider (ISP) via an ISDN telephone line, or an NT server can act as the router.

Typically, the ISP stages mail for the entire LAN. In most cases, the ISP will not initiate a call to the LAN; the LAN must call the ISP. In the implementation described here, NTMail runs on a local NT Server; each user on the LAN has their own POP mailbox on the server. Outgoing Internet mail gets staged at the server and delivered to the ISP from time to time; similarly, the server occasionally polls the ISP for any incoming mail, which is then distributed to the POP mailboxes and retrieved by the individual users. Local mail stays local and does not require connecting to the ISP.

Most of the set-up is per the standard NTMail installation. Note that you'll need to include the IP addresses of all of the local users in the server's HOSTS file, because SMTP_Server tries to resolve IP addresses to host names whenever a user connects to it, and if the address can't be resolved locally, it will probably try to go to another server on the Internet, which requires a connection to the ISP. (This problem has been resolved from version 2.10 onwards see SmtpResolveHost registry entry)

With NTMail installed and the appropriate HOSTS file, mail can be exchanged on the local network using, for example, Eudora. Mail destined for the Internet will also be sent, with timing specified by NTMail's configuration parameters. However, incoming mail will be held at the ISP until their is outgoing mail to trigger a connection (Note 1). To avoid this dependency, "dummy" outgoing mail is created at regular intervals to insure that incoming mail will arrive in a timely fashion. This is accomplished as follows:

Create a dummy mail template. This is accomplished by generating a simple mail message (contents unimportant) from one of the local workstations; it should be addressed to a "bit-bucket" mailbox that the ISP provides for this purpose (the mail is simply thrown away when it is received). (If your ISP does not offer such a capability, address it to the ISP's network administrator, and make the text of the message: "You are going to continue to receive copies of this message until you provide me with an address to use for this purpose." They will respond promptly.) When this message is sent to the server, it will be staged in the mail directory with a name like "aa001234.mbx". Capture this file and name it "dumpmail.txt".

Next, create a simple .BAT file (call it "kickdump.bat") which will copy dumpmail.txt back to "aa000001.mbx" in the mail directory. The following line will work:

IF NOT EXIST \SMTP_Mail\mail\aa000001.mbx COPY \SMTP_Mail\dumpmail.txt+\SMTP_Mail\dump2nd.txt \SMTP_Mail\mail\aa000001.mbx A few items to note: first, we check that there isn't already an existing aa000001.mbx file; coincidentally, some user could have just sent some outgoing mail and we wouldn't want to overwrite it (and if at least one piece of outgoing mail is already in the directory, we don't need any more to trigger the necessary events). Second, the COPY command concatenates anther file, dump2nd.txt, to the template. This second file must exist, but is just an empty file. The concatenation process causes the resulting file, aa000001.mbx, to carry a current creation date, rather than the creation date of the template file. If this isn't done, NTMail will start returning the mail to you rather than sending it on to the ISP once it ages past 72 hours.

A second line can be added to the .BAT file if desired: "MAIL -k" will cause the POST Service to immediately act on the new outgoing mail; if "MAIL -K" isn't included, then the mail will be posted when POST gets around to it.

Finally, execute of the BAT file needs to be scheduled. Windows NT has the AT command and scheduler service for this purpose. Once you schedule events with AT, it will automatically execute them at the intervals you specify. Here's another part of a BAT file that can be used to set up AT:

at 07:00 /every:m,t,w,th,f,s,su "\SMTP_Mail\kickdump.bat" at 08:00 /every:m,t,w,th,f "\SMTP_Mail\kickdump.bat" at 09:00 /every:m,t,w,th,f,s,su "\SMTP_Mail\kickdump.bat" at 10:00 /every:m,t,w,th,f "\SMTP_Mail\kickdump.bat" at 11:00 /every:m,t,w,th,f,s,su "\SMTP_Mail\kickdump.bat" at 12:00 /every:m,t,w,th,f "\SMTP_Mail\kickdump.bat" This schedules kickdump.bat to run every hour during the week and every two hours on weekends (add more lines to cover the rest of the day). If you execute the above once, AT will faithfully trigger kickdump.bat forever after. Then, at regular intervals, the ISP will be contacted and any waiting mail will automatically be retrieved and distributed to your local POP mailboxes, from which your local users can conveniently retrieve it.

(David Frankel)

Notes


webmaster@net-shopper.co.uk (12th May 1995)