Cover V01, I02
Listing 1
Sidebar 1


Security and Electronic Mail

R. King Ables

The rts (for Return To Sender) script in Listing 1 responds much like the Post Office does when it receives mail with the wrong name or address: it returns the message to the sender along with notification of why it is being returned. You can use this script in several ways:

  • You can tell the sender that the intended address no longer works at your site and, optionally, provide a corrected e-mail address. In addition, if you have the intended receiver's new address, you can send a message with the source address so that he/she may try to reach the sender directly. This is certainly more informative than the average mailer daemon message, but it still avoids forwarding the actual message, for internal as well as external users.

  • You can also use rts to tell senders that the address they've used was not precise enough (e.g., "smith") and to provide a list of people they might be trying to reach along with the appropriate addresses for each. This feature, along with a "dummy" alias, could also be used to auto reply to standard queries (for example to automatically mail your company's on-line catalog to anyone requesting it).

    We use rts with the sendmail(8) mail transport system (a mailer originating with BSD and used on Suns and many other common platforms). It should be usable with other mailers as well. If your mailer system adds header lines or changes the standard header lines, you may need to account for that. In general, you should define an alias for any name which is to trigger rts and have the alias pipe the contents of the mail message into the rts script. In our /etc/aliases file (for sendmail) we define an alias like this:

    username: "|/usr/local/etc/rts username"

    where "username" is the account name to be aliased. In this case, rts is located in /usr/local/etc, but it should be put wherever your local system administration tools are kept.

    When mail for username is received, it will be piped into the rts script with username used as the first argument. rts will generate a return message to the sending user. The return message will include the original message and an appropriate informative message for that particular address.

    In the case where a user has left, we use a message of the form:

    "As of 01-April-92, Joe User is no longer at XYZ Widgets, Inc. If you wish to contact him by electronic mail, you may reach him at [new e-mail address]. You may also contact him by phone at [new phone #]. Your message is being returned to you by an automatic process so you may resend it if you wish. No human was involved in returning your message to you."

    These messages are put in /usr/local/lib/rts in files named for each user for whom you want to provide the reply service.

    You can also use rts to point e-mail correspondents to more specific addresses. For example, if your site had several users named smith, you could define an alias for "smith" as:

    smith: "|/usr/local/etc/rts smith"

    and create a file /usr/local/lib/rts/smith containing:

    "You have sent a message to This is not sufficient to reach anyone here. We are automatically returning your message to you so you can resend it to the correct party. Please select an address from the list of possible meanings below:

    Bob Smith bob Jane Smith jsmith Janet Smith janet John Smith jrs Wanda Smith wanda"

    To automatically return an on-line company catalog, establish an alias of "catalog" and put the catalog in the /usr/local/lib/rts/catalog file.

    Using rts, it is possible to help internal as well as external users be sure they send messages to the correct place the first time, before sensitive information winds up in the wrong place.

    About the Author

    King Ables has been a UNIX user since 1980 and has been managing systems or developing system management and networking tools since 1983. He is currently doing system and network management development for HaL Computer Systems in Austin, TX.