The User’s ~/.forward File

The sendmail program allows each user to have a :include:-style list to customize the receipt of personal mail. That file (actually a possible sequence of files) is defined by the ForwardPath option (ForwardPath). Traditionally, that file is located in a user’s home directory.[7] We use the C-shell notation ~ to indicate user home directories, so we will compactly refer to this file as ~/.forward.

If a recipient address selects a delivery agent with the F=w flag set (F=w), that address is considered the address of a local user whose ~/.forward file can be processed. If the user part of that address contains a backslash, sendmail disallows further processing, and the message is handed to the local delivery agent’s P= program for delivery to the mail-spooling directory. If a backslash is absent, sendmail tries to read that user’s ~/.forward file.

If all the .forward files listed in the ForwardPath option (ForwardPath) cannot be read, their absence is silently ignored. This is how sendmail behaves when those files don’t exist. Users often choose not to have ~/.forward files. But problems can arise when users’ home directories are remotely mounted. If the user’s home directory is temporarily absent (as it would be if an NFS server is down), or if a user has no home directory, sendmail syslog(3)s the following error message and falls back to the other directories in its ForwardPath option:

forward: no home

If there are no further directories to fall back to, ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.