Chapter 26

Setting Up a Mail Server


CONTENTS


This chapter demonstrates how to set up and configure the Freeware EMWAC (European Microsoft Windows NT Academic Center) mail server to send and receive Internet e-mail. After reading this chapter, you will be able to set up a fully functional SMTP (Simple Mail Transport Protocol) mail server complete with mail list capabilities. At the end of this chapter, you also will learn about other e-mail servers available for NT. Although you can rely on an external Internet mail server, there are many benefits in setting up your own mail server. If you are relying on an external mail server, the following lists a few advantages of setting up your own SMTP mail server:

Due to this and other reasons, when establishing a presence on the Internet, it's important that you set up your own SMTP mail server. Although there are several commercial e-mail servers available for Windows NT, you can obtain a free e-mail server for Windows NT from the EMWAC Web site. The EMWAC Internet Mail Service (IMS) is part of its Internet tool chest for Windows NT, which is a collection of Windows NT Internet tools.

URL
The EMWAC Internet tool chest for Windows NT consists of a Freeware HTTP server, Gopher server, WAIS server, WAIS toolkit based on FreeWAIS 0.3, Internet Mail server, and a Finger server. For more information about the Internet tool chest for Windows NT, visit http://www.emwac.ed.ac.uk/html/toolchst.htm.

Note
Although the EMWAC mail server is provided free of charge, it comes with limited support. If prompt support is of importance to you, one of the commercial mail servers listed at the end of this chapter might better suit your needs. Although you can use the Freeware EMWAC mail server for most of your e-mail needs, there are more advanced mail servers available for Windows NT that provide additional functionality not offered by the EMWAC IMS.

You need the following in order to install the EMWAC mail service:

Note
Please note that the following directions are for installing version 0.60 of the Freeware EMWAC mail server. If you are installing a later version, the installation procedure may be slightly different from the directions that follow.

Obtaining the Software

Installing the EMWAC mail server is very easy and can be accomplished in just a few minutes. Before beginning to install the mail server, you need to log on to your Windows NT system as the administrator or as a user with administrative privileges. IMS comes in three flavors, depending on the platform you are using:

IMSi386.ZIP Intel version
IMSAlpha.ZIP Alpha version
IMSMips.ZIP MIPS version

Please download the correct version of the EMWAC mail server from the following URL.

URL
You can obtain the EMWAC IMS from
http://emwac.ed.ac.uk/html/internet_toolchest/ims/install.htm

After downloading the software, copy the distribution file to a temporary directory. Then, decompress the distribution file to the same temporary directory. The EMWAC mail service distribution file consists of the following files:

SMTPDS.EXEThe SMTP Delivery Agent
SMTPRS.EXEThe SMTP receiver service
POP3S.EXEThe POP3 server service
IMS.CPLThe Control Panel applet used to configure various aspects of the IMS
IMSCMN.DLLA DLL containing common code used by various IMS services
COPYRITE.TXTCopyright information about the IMS software
READ.MESummary of new features, how to obtain support, and so on

URL
When installing the IMS, if additional information is needed, it can be obtained from
http://emwac.ed.ac.uk/html/internet_toolchest/ims/ims.htm

Note
Please note that you will not be able to start the mail services by executing the .EXE files from the command prompt. The .EXE files are Windows NT services and need to be installed from the command prompt before they can be started as services.

Removing a Prior Version

Before proceeding to install the EMWAC mail service, you have to remove any prior IMS installations from your system. The current version of IMS you might have installed can be determined by logging on to the directory (usually %SYSTEMROOT%\SYSTEM32) containing the mail service files and typing SMTPDS -version.

Caution
When installing a new version of IMS, it's not sufficient to simply stop the mail services, copy the new files over existing files, and restart the mail services. This can bring about undesired results because different versions may use different registry entries.

In order to remove an older version of IMS, the mail services first need to be stopped. This can be accomplished by invoking the Services applet from the Control Panel and stopping the mail services. The three mail services will typically contain the strings SMTP, EMWAC, and POP3. After stopping the mail services, you can remove them from your system by executing SMTPDS.EXE, SMTPRS.EXE, and POP3S.EXE from the command prompt with the -remove argument.

After removing the earlier version of IMS, the new version can be installed. You might need to reboot your system before new IMS files can be copied over the old files.

Installing the EMWAC Mail Server

After obtaining the IMS software and decompressing the distribution file to a temporary directory, you need to copy the essential mail service files to a permanent directory. Because most Windows NT services are located in %SYSTEMROOT%\SYSTEM32, you might want to copy IMS files to that directory. Listed next are essential IMS files that you need to copy to either %SYSTEMROOT%\SYSTEM32 or a permanent directory:

After copying IMS.CPL to your %SYSTEMROOT%\SYSTEM32 directory, when you invoke the Control Panel, you will see the EMWAC mail services icon among other Control Panel icons, as shown in Figure 26.1. Then, by using the -INSTALL argument, install all three executable mail service files. This is done by logging on to the permanent directory to which you copied the executable files and typing the following:

Figure 26.1: After IMS.CPL is copied to the %SYSTEMROOT%\ SYSTEM32 directory, the EMWAC mail service icon is visible in the Control Panel.

SMTPRS -INSTALL
SMTPDS -INSTALL
POP3S -INSTALL

After installing the preceding three programs, they will register themselves with Windows NT's service manager. At this time, if you invoke the Services applet from the Control Panel, you will see the following three mail services installed on your system, as shown in Figure 26.2:

Figure 26.2: After installing the three mail service applications, they are visible in Control Panel's Services applet.

Because the mail server has to be continuously functioning to receive Internet e-mail, it should be set up to start as soon as your server boots. By configuring the EMWAC IMS to start automatically, as soon as your server boots and establishes the Internet link, the mail server will become immediately operational. Because IMS is an NT service, upon establishing the Internet link, even if no one is logged on to your server, the IMS will start accepting e-mail.

You can set up the EMWAC mail services to start automatically by going into Control Panel | Services and selecting all three mail services, one at a time, and changing the startup value to Automatic, as shown in Figure 26.3.

Figure 26.3: By changing the startup value to Automatic in the Control Panel, the EMWAC mail services can be configured to start functioning as soon as NT boots up.

Configuring the EMWAC Mail Server

After installing the IMS, you need to configure it by running the mail server configuration applet from the Control Panel. The EMWAC Internet Mail Services applet is shown in Figure 26.4 and is very easy to use. As shown in Figure 26.4, the configuration applet contains a tabbed data entry form with various input controls. The first tabbed sheet enables you to customize various directories that will be used by the IMS. If you would like to keep all user e-mail in its respective directories, you can specify a virtual path name by appending %USERNAME% to the end of the path name. For example, by specifying a directory such as I:\USERS\MAIL\%USERNAME% as the mailbox directory, all user e-mail will be stored in its own directory in the I:\USERS\MAIL\ directory. If you would rather have all e-mail stored in a directory that's relative to a user's home directory, you also can specify a path such as %HOME%\INETMAIL\INBOX.

Figure 26.4: The EMWAC Internet Mail Services applet.

Note
Please note that after making any changes in the IMS configuration applet, you need to manually stop and restart all three mail services for the changes to take effect.

After specifying mail directories, you need to designate a user who will be the postmaster for your system. If mail traffic on your system is low, you might want to define the administrator as the postmaster. However, if you expect to process a large number of e-mail messages, you might want to create a new user and designate this user to be the postmaster. After providing a valid NT username as the postmaster and specifying valid directories, the IMS is configured and ready to use. However, before users can log on to read their e-mail, user accounts have to be assigned a certain Windows NT user right. Also, don't forget to stop and restart the mail services for the changes you just made to take effect.

Setting Up User Permissions

Before users can log on to the mail server from various mail clients to read their e-mail, they should be given the Advanced Windows NT user right "Log on as a batch job." In order to assign this right to a single user, or many users, the User Manager program has to be invoked. After selecting a user or group you wish to allow to log on and read e-mail messages, click on Policies and then User Rights. When the User Rights Policy dialog box appears, click on the Show Advanced User Rights checkbox so that the advanced user right "Log on as a batch job" becomes visible in the pull-down list, as shown in Figure 26.5. After clicking on the Show Advanced User Rights checkbox, you can select additional users or groups you wish to provide e-mail services by clicking on the Add button. After selecting additional users and groups, click on OK to assign the advanced user right "Log on as a batch job" to users and groups you selected. Then, users and groups this right was assigned to will be able to send and receive Internet e-mail using the EMWAC IMS.

Figure 26.5: The advanced user right "Log on as a batch job" has to be assigned from User Manager to users and/or groups to whom you wish to provide e-mail services.

Security
Rather than selecting individual users one by one and assigning them the "Log on as a batch job" user right, you can create a user group called EMWAC Mail Users. This group can be assigned the user right "Log on as a batch job." Then, users you wish to provide e-mail services to can be made members of this group. This will allow you to have more control of who can use your Internet mail server.

After following these steps, the EMWAC mail server is now configured and ready to accept and deliver Internet e-mail.

URL
You can obtain additional installation instructions for installing the EMWAC mail server from
http://emwac.ed.ac.uk/html/internet_toolchest/ims/install.htm

Setting Up E-Mail Aliases

Mail messages received by the IMS can be configured to be redirected to another address. For example, if e-mail to info@domain.name has to be redirected to webmaster@domain.name, an alias can be created for info@domain.name. This is done by executing the IMS applet from the Control Panel and clicking on the Aliases tab; then you can create an alias, as shown in Figure 26.6. In the space provided for the username, type the user for whom you would like to create an e-mail alias. In the case of this example, the username will be info. In the space provided for Map to, type the address to where you want the e-mail redirected. For the purpose of this example, the Map to username is webmaster.

Figure 26.6: You can create an e-mail alias by specifying the user whose e-mail you want to be redirected and the e-mail address to where you want the e-mail to be redirected.

Then, click on Set to define the alias and click on OK to get rid of the dialog box. In order for the change to take effect, don't forget to stop and restart the mail services. After the mail services are stopped and restarted, all e-mail directed to info@domain.name will be redirected to webmaster@domain.name.

You also can use wildcards to define e-mail aliases. For example, the alias T*Y would match any username that begins with a T and ends with a Y. Please note that aliases are not case-sensitive. Also, e-mail aliases are processed from top to bottom. Therefore, it's a good idea to move all aliases with wildcards to the bottom of the list to avoid misdirection of e-mail.

Using the EMWAC Mail Server for Mailing Lists

The EMWAC IMS also enables you to define Internet mailing lists. With the aid of mailing lists, it's possible to create discussion groups via e-mail. To create a mailing list, invoke the IMS applet from the Control Panel and click on the Lists tab. At first, the Lists tab doesn't contain any predefined e-mail lists and looks like the dialog box shown in Figure 26.7.

Figure 26.7: You can use the Lists tab of the IMS configuration applet to define e-mail lists.

In order to define an e-mail list, press the Add button of the Lists tab. You see a new dialog box similar to the one shown in Figure 26.8.

Figure 26.8: By clicking on Add from the Lists tab, you can create new mailing lists and insert or delete mail list users.

You can create an e-mail list by using the dialog box shown in Figure 26.8. For the purpose of this example, you are shown how to create a mailing list called win-nt-list with two list members. The list will be set up so that only members of the list can post messages to the list, and undeliverable messages will be discarded. Also, the list will be configured so that users can join and leave the list at any time without moderator intervention.

When creating an e-mail list, you first need to give the list a name. This name is typed in the space provided for the Mailing list name. After typing the name of the e-mail list, you need to decide what should be done about non-deliverable mail message reports. The options you have are Discard, Return to sender, and Send to. This information is used by the mailing list when it cannot deliver a message to a certain user. This can be due to an e-mail server being down, incorrect e-mail address, network problems, and so on. If this option is set to Discard, all messages that cannot be delivered will be discarded without generating any reports. The Return to sender option will send a message non-delivery report to the sender. By using the last option, Send to, you can have all undeliverable messages directed to a certain e-mail address. For the purpose of this example, Discard is selected.

You can set up the new e-mail list you're creating as a moderated or unmoderated mail list. If you would like the list to be moderated by someone, you need to type this user's e-mail address in the space provided. The moderator can be set up to control those leaving and joining the mail list. Unless you are maintaining a low-volume, private e-mail list, you should not set up the moderator to control users joining and leaving the list because this can be time-consuming and cause delays. For the purpose of this example, this space is left blank so that users can join and leave the list as they please.

The EMWAC IMS also enables you to control who is allowed to post messages to the mail list. The three options you have available are Anyone, Member, and Moderator. By selecting Member, you can make sure that only members who subscribe to the mail list can post messages. In this example, the mail list is configured to enable only members to post messages.

If you have a text file of users, you can use the Import/Export feature to add or save several users at the same time. When importing a file, each line of the file should contain only a comment or information for one user. Lines that begin with a # are interpreted as comments. The general format of text files that can be imported is

# Comment
FirstName LastName <userID@domain.name>

It's possible to manually add users to the mail list by typing the e-mail address of users in the space under New Member and clicking on the Add button, as shown in Figure 26.8. (By using the Delete button, you can delete users from the list.) After adding users, the mail list is now all set up and ready to serve users. However, before the mail server starts accepting list e-mail, the IMS service has to be stopped and restarted for the changes to take effect.

Internet users can join an existing mail list by sending a message to the list server with the text SUBSCRIBE as the body of the message. Users should direct list commands to the address of the e-mail list with -request appended to the name of the mail list. For example, the mail list you just created is called win-nt-list. Therefore, commands to this mail list should be directed to win-nt-list-request@domain.name.

The next sections discuss the list commands understood by IMS. These commands should be sent as the body of the message with the string -request appended to the list name.

SUBSCRIBE or JOIN

Users can use SUBSCRIBE or JOIN to subscribe to an existing mail list by including the string SUBSCRIBE or JOIN in the body of the e-mail message. After the IMS receives a subscribe request, it responds by sending a message to the sender indicating if the user was successfully subscribed. However, if Moderator Configured Join is enabled, all subscribe messages will be sent to the moderator of the list.

UNSUBSCRIBE or LEAVE

Use the UNSUBSCRIBE or LEAVE command to leave a mail list. If Moderator Control Leave is enabled for a mail list a user wants to unsubscribe from, the unsubscribe message will be forwarded to the moderator of the list. Then, the moderator needs to manually delete the user from the mail list. For the purpose of this example, if a user wants to leave the mailing list that was just created (win-nt-list@domain.name), the request should be sent to win-nt-list-request@domain.name with the body of the message being UNSUBSCRIBE.

HELP

The HELP command sends to the user that requested the information a list of commands that are understood by IMS mail list server.

STOP

The STOP command prevents IMS from processing the remainder of a message searching for list commands. The STOP command is particularly useful when a user whose mail client automatically inserts a signature subscribes to a mail list. By using the STOP command immediately after the list server command, the list server will stop processing the remainder of the message and not attempt to interpret the user's signature as a list command.

EMWAC Mail Server Registry Entries

Although most aspects of the EMWAC mail service can be configured via the Control Panel applet, some settings cannot be modified using the Control Panel program. In order to change these settings, you need to make various changes to certain registry keys. Listed next are a few important registry entries used by the EMWAC IMS.

Caution
You need to be careful when making changes to the registry to alter various attributes of the EMWAC mail service. When making changes to the registry, please be sure to make modifications only to specific registry entries.

Registry
The registry keys listed next are common to more than one mail service. These keys can be found at
HKEY_LOCAL_MACHINE\SOFTWARE\EMWAC\IMS

SMTP Receiver

Listed next are SMTP receiver service specific registry keys.

Registry
SMTP receiver service specific registry keys are located at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SMTPRS\Parameters

SMTP Delivery Agent

Listed next is an SMTP delivery service related registry key.

Registry
SMTP delivery service related registry keys can be found at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SMTPDS\Parameters

POP3 Server

POP3-specific configuration information is stored under the following registry key.

Registry
POP3 server related registry entries can be found at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\POP3S\Parameters

Figure 26.9: All user e-mail is stored in each user's mail box directory with the extension defined in the registry key MessageExtension.

Setting Up a Command-Line Mail Sender

In addition to providing users the capability to send and receive Internet e-mail, you can use the e-mail server you just set up for a variety of other purposes. A handy way to keep track of various activities scheduled to run on your server is to have the results of those activities e-mailed to you. This can be done with the aid of a command-line mail sender such as Blat. For example, when performing a tape backup, the results of the backup, such as error messages, can be saved to a log and e-mailed to the system administrator.

Tools
By installing Blat on your server, you will be able to set up batch scripts that e-mail you results of various tasks such as tape backups. Blat also is used by CGI programs to e-mail user feedback and comments.

Blat is a public domain Windows NT console utility that sends the contents of a file as an e-mail message using SMTP. Blat is useful for creating scripts where mail has to be sent automatically (CGI scripts, results of backups, batch jobs, and so on). You can install Blat in just a few minutes after downloading it from the Web site listed next.

URL
You can obtain Blat from
http://gepasi.dbs.aber.ac.uk/softw/blat.html

After downloading Blat, you need to install it on your NT server. Blat is distributed with the source code. The only two files you really need are Blat.exe and gwinsock.dll. These two files should be located in the %SystemRoot%\SYSTEM32 directory. After decompressing the Blat distribution file, you need to copy Blat.exe and gwinsock.dll to %SystemRoot%\SYSTEM32. Then, you can install Blat on your system by typing

Blat -install your_site_address your_userid@your_site_address

Example:

your_site_address = wonderland.dial.umd.edu
your_userid@your_site_address = sanjaya@wonderland.dial.umd.edu

After typing the command preceding this paragraph, Blat will install itself and let you know that the SMTP server was set properly.

Tip
At this point, if you want to quickly e-mail a file, you can do so by typing
Blat <filename> -t <recipient>

Other NT Mail Servers

In addition to the EMWAC mail service, there are a number of other mail servers for Windows NT. Although these mail servers are not free, they come with better support than the EMWAC server and provide additional functionality. Mail servers listed next are also more robust and secure.

NTMail Mail Server

NTMail is a set of feature-rich mail services for Windows NT. These services provide a computer running Windows NT Server or Workstation with SMTP and POP3 services for sending and receiving Internet e-mail. NTList is an addition to NTMail and provides additional functionality by providing list server capabilities.

URL
You can find the latest version of NTMail and its documentation at Internet Shopper's WWW site. You can obtain NTMail from
http://www.net-shopper.co.uk/software/ntmail/index.htm

The following are some features of NTMail:

Post.Office Mail Server

Post.Office is a secure and easy-to-use mail service for Windows NT. In addition to providing SMTP and POP3 services, Post.Office also includes an integrated finger server. One of the highlights of Post.Office is its capability to be administered via a Web browser using forms. If you don't always have ready access to your NT server, you should consider Post.Office because it can be administered remotely using a Web browser.

The following are some features of Post.Office:

URL
You can obtain Post.Office mail server for Windows NT from
http://www.software.com/prod/po/po.html

MetaInfo's Sendmail with POP3

MetaInfo's Sendmail for Windows NT is a direct port of the UNIX version 8.7 of Sendmail. This mail server brings the power, flexibility, and efficiency of UNIX into the user-friendly and reliable environment of Windows NT.

Following are some features of MetaInfo's Sendmail:

URL
You can obtain MetaInfo's Sendmail with POP3 from MetaInfo's Web site at
http://www.metainfo.com/MetaInfo/Sendmail/Homepage.htp

Summary

This chapter demonstrated how to install and configure the Freeware EMWAC mail server. All aspects of setting up the mail server, from where to obtain the software to giving users necessary permissions to read their e-mail, were covered. It also discussed how to use the mail list feature of the EMWAC mail server. By following directions given in this chapter, you can install and configure the EMWAC mail server to run on your system. To provide you with an overview of various commercial mail servers available for NT, several commercial mail servers also were discussed at the end of this chapter. If you require more information about these mail servers, their URLs also were given. In addition to setting up the EMWAC mail server, you also were shown how to install and use Blat, a command-line SMTP mail sending program.

What's Next?

Aside from the EMWAC mail list server, there are several other mail list programs available for Windows NT that offer more functionality. Although you can use the EMWAC list server to host a mail list, it's not very customizable. The next chapter demonstrates how to set up a more feature-rich mail list server for NT. The following chapter also demonstrates how you can effectively use a mail list server to distribute information as well as create discussion groups on the Internet.