Managing sendmail Services in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014

.forward Files

Users can create a .forward file in their home directories that sendmail, along with other programs, can use to redirect mail or send mail. Refer to the following topics.

For a task map, refer to Administering .forward Files (Task Map) in Chapter 2, Administering Mail Services.

Situations to Avoid

The following list describes some situations that you can avoid or easily fix.

  • If mail is not being delivered to the expected address, check the user's .forward file. The user might have put the .forward file in the home directory of host1, which forwards mail to user@host2. When the mail arrives at host2, sendmail checks for user in the NIS aliases and sends the message back to user@host1. This routing results in a loop and more bounced mail.

  • To avoid security problems, never put .forward files in the root and bin accounts. If necessary, forward the mail by using the aliases file instead.

Controls for .forward files

For the .forward files to be an effective part of mail delivery, ensure that the following controls (mostly permissions settings) are correctly applied.

  • The .forward file must be writable only by the owner of the file. This restriction prevents other users from breaking security.

  • The paths that lead to the home directory must be owned and writable by root only. For example, if a .forward file is in /export/home/terry, /export and /export/home must be owned and writable by root only.

  • The actual home directory should be writable only by the user.

  • The .forward file cannot be a symbolic link, and this file cannot have more than one hard link.

.forward.hostname File

You can create a .forward.hostname file to redirect mail that is sent to a specific host. For example, if a user's alias has changed from to, place a .forward.phoenix file in the home directory for sandy.

% cat .forward.phoenix
"|/usr/bin/vacation sandy"
% cat .vacation.msg
From: (via the vacation program)
Subject: my alias has changed

My alias has changed to
Please use this alias in the future.
The mail that I just received from you
has been forwarded to my new address.


In this example, mail can be forwarded to the correct place while the sender is notified of the alias change. Because the vacation program permits only one message file, you can forward only one message at a time. However, if the message is not host specific, one vacation message file can be used by .forward files for many hosts.

.forward+detail File

Another extension to the forwarding mechanism is the .forward+detail file. The detail string can be any sequence of characters except operator characters. The operator characters are .:%&!^[]+. By using this type of file, you can determine if someone else is using your email address without your knowledge. For instance, if a user tells someone to use the email address, the user would be able to identify any future mail that was delivered to this alias. By default, any mail that is sent to the alias is checked against the alias and the .forward+detail files. If no matches are made, the mail falls back to delivery to, but the user is able to see a change in the To: mail header.