Chapter 8

Serving e-mail via tcp/ip


CONTENTS


This chapter covers running your own e-mail server. E-mail is responsible for the greatest percentage of packet traffic on the Internet. On the Intranet, it should not be overlooked as being potentially the single greatest thing you can do to enhance employee communications.

It is customary when one is visiting a home page on the Web that comments can be e-mailed to an address of the form webmaster@yourco.com. If you would like to carry on this tradition, you will probably want to run your own mail server. Of course, you could also publicize your own e-mail name on your Intranet Web pages (for example, jsmith@yourco.com) and encourage your customers to write to you as the Webmaster.

The industry for e-mail server software on Windows NT is really heating up. Within the last year, many such packages have become available. All are very competitive in price and features. The one I chose to include with this book is Post.Office from a humbly named company called Software.Com in Santa Barbara, California.

While we're on the subject of mail, I'll also show you how to install Blat. Blat is a console program that can e-mail HTML form data. The astute reader might remember why we need console programs: They are the types of CGI application that can be launched by the Web server. CGI applications are not GUI programs.

Here's an example of what you can do with Blat. Suppose you have a suggestion box on your Intranet and you would like to encourage and track your customer feedback. In order to make it as simple as possible for your customers to express their opinions about your Intranet, you provide a convenient HTML form on your home page. When a customer fills out the form, the SUBMIT action invokes a CGI program to parse the data. Then it is passed to Blat to be e-mailed to your inbox.

Post.Office and SMTP

Post.Office is a feature-rich set of utilities. It contains RFC-compliant SMTP and POP servers that operate as 32-bit services on Windows NT. The next several sections describe pre-installation procedures for Post.Office. I strongly advise that you read through the whole chapter and through the Post.Office documentation before you begin the installation process. Post.Office is very powerful and fairly easy to use, but if you are at all like me, it might take some time for the implications of all the new terminology to sink in.

Note
Post.Office uses long filenames. Although those are compatible with FAT in Windows NT 4, for security reasons, Software.Com strongly recommends that the installation drive be formatted with NTFS.

Creating an NT Login Account for the Service

Every process running under Windows NT operates with the privileges of an account (either local or part of a domain, if you're using NT Server). The Post.Office service can operate using the privileges of the built-in System account (which is the default during install) or as any local account that is preconfigured (prior to running the installation program) on the machine. This decision is primarily a security consideration. The advantage of using an account other than the built-in System account is that the default installation of Post.Office sets up permissions that will not allow other processes or accounts to access any of the Post.Office directories/files or registry information. (Additionally the Post.Office service will be unable to read, modify, and delete any system or user files.) The main disadvantage of using an account other than System is that you need to set up the local account and group, and ensure that they are not deleted, because Post.Office will not be able to run if its account is disabled.

It is recommended that you use a new account and group other than the built-in System account for sites connecting to the Internet. If you choose to use the system account, you may skip the remainder of this section and proceed to the section titled "Miscellaneous Pre-Installation Planning." When prompted for the system account, please type System (with an uppercase S).

You will need to use the User Manager (as an administrator) to create an account and group for the service to use during normal operation. The new account and group should be specifically for the Post.Office service, and should have no other members or groups. In the Windows NT User Manager, the properties of the account must have User Cannot Change Password and Password Never Expires checked, and must not have User Must Change Password at next login checked.

NT Workstation Installation Notes
You will be creating a local user and group. If the workstation is also part of an NT Domain, it is suggested that you use a local user and local group (specific to the workstation, not a member of the NT Domain). Be sure that you include only the Post.Office user in the new group and that the Post.Office user has membership in only the new Post.Office group.

NT Server Notes
On a server acting as a primary or backup domain controller, it is suggested that you use a global user/global group for the Post.Office service account. On a server that is not a PDC or BDC, use a local user/local group for the Post.Office service account.

After creating the Post.Office user and group, be sure to set the Post.Office group to be the primary group for the Post.Office user. (Under the user properties/Groups button, select the Post.Office group on the left side and click the Set Primary Groups button.) Then remove the domain users group from the list of groups for the Post.Office user. (It is added by User Manager by default.)

You must also give the account the Logon as a Service privilege. This is accomplished while still in the User Manager program. Under the Policies menu, select the User Rights option. There is a checkbox titled Show Advanced User Rights, which must be checked. Under the scrollbar titled Right:, choose Log on as a Service and add the account name (chosen above) that you created for the mail system to this privilege list. You will need to choose the Add button, Show Users, and then the Post.Office user account (it will be near the bottom of the list); then choose the Add button.

Setting Permissions for the System Directories

To ensure that the Post.Office installation program is able to give the proper permissions for operation, it is necessary that the owner of the System directories be the administrator. You can easily determine this with Explorer (or File Manager, which is still available in Windows NT 4). Select the system directory (/winnt, /winnt35, or /windows, depending on your specific installation) and select Permissions under the Security menu item. The directory owner must be administrator for the install to proceed. If this is not the case, you will need to take ownership of the directory, subdirectories, and files within-as one of the administrators. This is not a step to take lightly, so please review the Post.Office online help and additional manuals to be sure that you understand this operation.

Machine Name and Internet Protocol Number

The installation program will request the hostname (without domain name) from the TCP service. Please ensure that the hostname listed in the Control Panel | Network | Protocols | TCP/IP | Configure | DNS | hostname field is the name you are planning to use. In addition, the install program must do a reverse lookup to turn an IP number into a hostname. The file named HOSTS in \winnt\system32\drivers\etc has a list of IP numbers and hostnames. Please ensure that the proper hostname and IP numbers are listed. Sites using DNS may have only a localhost entry in this file and don't need to create a new entry if one is not present.

A sample HOSTS entry for a machine rome, in the domain software.com, with an IP address of 198.17.234.2 is

198.17.234.2   rome  rome.software.com

There are two names here for the same machine: rome and rome.software.com, separated by a space.

Note
The current version of the Windows NT TCP services is case-sensitive, so use lowercase names in the HOSTS file.

Do a final check of the machine name/IP Number configuration by running a Command window and issuing these commands:

> ping your-host-name (example: ping rome )
Pinging host-name [IP number]
Reply from IP number ....
> ping HostName.DomainName (example: ping rome.software.com)
inging HostName.DomainName [IP number]
Reply from IP number ....

Please verify for both cases that the IP numbers returned by ping are what you think they should be and that the pings are successful. The result of a misconfigured hostname or IP number will be the inability to request forms for adding, changing, or deleting accounts-and for configuration information.

Miscellaneous Pre-Installation Planning

There are three passwords used in the installation section: the Local account password, the Postmaster password, and Mail account password. For security reasons, each of these should be different. The Local account password is used by the Service Control Program (in Windows NT) to log in the Post.Office service and give it access rights on the machine it is running. The Postmaster password is used by Post.Office to verify any administrative actions such as creating a new mail account. Your Mail account password is the password assigned to your e-mail account and allows you to retrieve your mail (as it is also your POP password), and lets you make any changes to your e-mail account (such as finger information).

Software License Number

During the installation, you will be prompted to enter a license number. If you want to proceed with the 45-day trial period, enter trial instead of a number. You will be able to rerun setup later and update your license information with a permanent, valid license number. You should purchase this from Software.Com before the trial period expires. To order, send e-mail to sales@software.com.

WWW Server Port Number

The Post.Office mail service comes with an integrated WWW Server for remote management via a Web browser. This module operates on a specific port (which is usually 80 by default for WWW Servers). If you have another WWW server (such as IIS) on the same machine already using port 80 (the default if you have not specified it), please choose another port such as 81 for Post.Office. If you do not specify another port and there is another WWW Server already using port 80, either Post.Office's WWW Server or your existing WWW Server will not start properly and will put a message in the event log explaining this. If you do choose to operate Post.Office's WWW Server on a port other than 80, you will need to specify the port number you have picked when you give the browser the URL. For example, if you choose 81, the URL will be http://yourhost:81.

Installing Post.Office

When you run the installation program from the CD-ROM with this book, you can choose to install any of the programs mentioned in Appendix D. In many cases, you can install the software directly from the CD-ROM to your hard drive; in other cases, you might want to copy the files to a temp directory on your hard drive and then execute the setup program that comes with the particular application.

The last step in the installation, after the service is operating, is to create at least one mail account for the person who will initially be acting as the postmaster (to create new accounts and change mail system parameters). Direct your WWW browser to the Post.Office WWW Server management URL and answer the questions on the form.

Post-Installation Setup

The Post.Office services should be installed and operating. You can check this from a Command window by typing

> finger postmaster@hostname

You should see

[hostname]
Account Name:  Mail Administrator
Email address: Postmaster@yourhost
----------
mail system administrator.

Configure via Your WWW Browser

Using your WWW browser, you can configure Post.Office quite easily. The URL for the server is http://hostname:Port# (for example, http://oslo.software.com:81). If you used the default port during the installation, you do not need to use the Port# part (for example, http://oslo.software.com).

You will be presented with an Authentication screen. Please use Postmaster@yourhost as the e-mail address and the postmaster password to get to the menus. Mail users can change their individual account information by using their personal e-mail address and mail account passwords. See Figure 8.1.

Figure 8.1: Configuring Post.Office via HTML.

Upon successful authentication, you will receive a list of available forms. The first step is to ask for a blank account form and create an account for yourself, and give your new account Postmaster privileges.

Creating New Mail Accounts

After installing Post.Office, add info and webmaster to the root mailbox. This will allow you to log into your mail server with a mail client such as Eudora as root and get any mail addressed to info@yourco.com or webmaster@yourco.com.

To create a new account, select the Account Form (leave the field above blank) and click the REQUEST button for the selected form. You will be presented with an empty account form. Fill this out as desired and submit when finished. Here is an annotated list of the fields:

User's Real Name: Your name (for example, Jane S. Doe).
Mail Account Password: (Used by your mail program for POP3 pickup.
Finger Information: (You can skip this for now and add later.)
Internet Addresses: Name@host (for example, Jane@lhasa.software.com).
From Address Rewrite Style: (You can skip for now.)
POP3-Delivery: Check Box: You will probably want POP delivery.
POP3-Username: POPName for your mail program (for example, Jane).

Setting up the Default Account

You might want to configure the Default account form to set up any commonly used parameters as defaults.

Get a List of Accounts

You can get a list of mail accounts on the system with the List of Existing Accounts form. All your accounts will be listed by account name and their first Internet address (called the primary address for the account).

Blat

Blat is a Public Domain Windows NT console utility that will e-mail a file to a user via SMTP. A Registry entry is generated when the program is used with the -install flag. This stores the address of the default SMTP server and the address of the default sender. Blat is used by CGI Perform (mentioned in Chapter 19) to mail the contents of an HTML form to whomever you choose. Post.Office comes with a similar utility called postmail. Postmail is also available for free at the Software.Com Web site, and it should work even if you choose to use a different mail server.

Note
The binary files for Blat require the Intel 486 platform. However, source code is included (Wow!), so you can recompile the program if you need to run it on a different architecture.

Installing Blat

The files for Blat can be copied from the CD-ROM to your hard drive. Then follow these steps:

  1. Copy the file gensock.dll to your \WINNT\SYSTEM32 directory or to any other directory in your path. (Check if you already have this DLL; if so, copy only the DLL if the date is more recent than the existing one.)
  2. Copy the file Blat.exe to your \WINNT\SYSTEM32 directory or to any other directory in your path.
  3. Type: Blat -install yourco.com youremail@yourco.com.

A Registry entry is generated when the program is used with the -install flag. This stores the address of the default SMTP server and the address of the default sender (which may be overridden with the -f flag).

Impersonation can be done with the -i flag, which puts the value specified in place of the sender's address in the From: line of the header. When this is done, however, the real sender's address is stamped in the Reply-To: and Sender: lines. This feature can be useful when using the program to send messages from NT users who are not registered on the SMTP host.

Blat Syntax

The Blat command line has a few variations. Here are the command types, followed by a description of each of the syntax elements.

Blat filename -s subject -t recipient -f address -i address
Blat -install server address senders address
Blat -h -install server address senders address

which sets the address of the default SMTP server.

filename

which is the file with the message body.

-s subject

which is the (optional) subject line.

-t recipient

which is the recipient's address.

-c recipient

which is the carbon copy recipient's address.

-f sender

which is the sender's address (must be known to the SMTP server).

-i address

which is a From: address, not necessarily known to the SMTP server.

-h

which displays this help.

-server server address

which overrides the default SMTP server to be used.

Note that if the -i option is used, sender is included in the Reply-to: and Sender: fields in the header of the message.

Sample Blat Commands

You can use Blat from the command line or implement your own CGI applications that call Blat. Here are some examples of using Blat from the command line:

Blat -install smtphost.bar.com foo@bar.com

sets the host and userid.

Blat -install smtphost.bar.com foo

sets the host and userid.

Blat -install smtphost.bar.com

sets the host only.

Blat myfile.txt -s "A file for pedro" -t foo@bar.com

sends a file with subject line A file for pedro.

Blat myfile.txt -s "A file for mark" -t fee@fi.com -f foo@bar.com

The -f option overrides the default sender.

Blat myfile.txt -s "A file for pedro" -t foo@bar.com -i "devil@fire.hell"
-i replaces From: line address (but leaves Reply-To: and Sender: lines).
Blat myfile.txt -s "animals" -t fee@fi.com -c "moo@grass.edu,horse@meadow.hill"

-c mails carbon copies to users moo@grass.edu and horse@meadow.hill.

The authors of Blat have very generously placed it in the public domain. This means you can use Blat free of charge, for any purpose you like. The source code is also available free of charge. The authors of Blat are Mark Neal (mjn@aber.ac.uk) and Pedro Mendes (prm@aber.ac.uk).

Electronic Mail Distribution Lists and List Servers on Your Intranet

If you've used e-mail, you probably know that you can create distribution lists of your associates' and friends' e-mail addresses, and then send messages to the lists just as if they were individual addressees. You probably also know there are thousands of special-interest Internet e-mail distribution lists, ranging from those discussing Internet Firewalls (see Chapters 10 and 28) to those discussing feminism and/or men's rights. These lists are used for communication, discussion, and collaboration among like-minded people.

Besides these distribution lists, there are automated list servers on the Internet that will do something for you if you send e-mail to them. Some list servers will automatically add your e-mail address to an e-mail distribution list (or take it off). Others will respond to specially worded e-mail messages to retrieve information for you and deliver it to you via e-mail. Special FTPMail servers will actually perform an anonymous FTP file retrieval for you while you sleep, and then deliver the file with the rest of your e-mail.

There's no reason you can't put these e-mail-based services to work in your Intranet. Web browsers are adding support for sending and reading e-mail. You can piggyback this built-in e-mail support onto both simple e-mail distribution lists and list servers, thereby providing your customers with value-added services on your Intranet.

Running a List Server

A list server (also called listserv) is a service program that lets its group's members broadcast e-mail messages amongst themselves. An individual user sends a single e-mail message to the server, which in turn sends it to all the other members of the listserv group.

It is somewhat beyond the scope of this chapter, however, I can briefly mention the feature set of the Software.Com list server which is a companion product to Post.Office. You can get further information from Software.Com at http://www.software.com/ or support@software.com. If you try the Post.Office mail server and like it, you will probably want to contact the company and ask for the commercial release of their companion list server.

Features of Software.Com List Manager

Here is a quick look at the features of the Software.Com List Manager:

Summary

In the next chapter, you will continue building server capabilities into your Intranet when you install and configure the IIS FTP and Gopher servers. These services should not be overlooked when you are designing a complete Web site. FTP is the Internet champion of file transfers, and Gopher is an excellent means to publish textual information, especially for users who might not have graphical workstations.