The .forward file also allows the user to redirect mail to files or programs. A .forward file with the following contents redirects any incoming messages to jd@company.com, appends a copy of the message to the file /var/tmp/mail.log, and pipes a copy of the message to stdin of the /usr/bin/mymailer program:zippy@state.edu
bongo@widgets.com
In general, file-type recipients must be writable by everyone. However, if sendmail is running as root and the file has setuid or setgid bits set, then the message will be written to the file.jd@company.com
/var/tmp/mail.log
| /usr/bin/mymailer
Users can redirect mail to themselves in addition to sending it to other recipients. This feature is particularly useful if the users want to continue to receive mail in their own mailboxes while passing copies of each incoming message to some alternative destination. For example, say that the home directory for user john contains a .forward file with the following contents:
sendmail behaves as follows:
\john, |/usr/sbin/vacation