Delivery to Files

When any of the addresses to the right of a colon in the alias list begin with a / character, delivery is made by appending the mail message to a file. This is automatic with all modern configuration files, but there are exceptions.[196] Beginning with V8.7 sendmail, any delivery agent for which the F=/ flag (F=/ (forward slash) on page 766) is set can also append messages to files. If you want to disable this ability, delete the F=/ flag from all delivery agent declarations in your configuration file.

In the list of addresses to the right of the colon, sendmail considers any local address that begins with the / character to be the name of a file.[197] Whenever the recipient address is a file, sendmail attempts to deliver the mail message by appending it to the file. This ability to deliver mail to files is included in sendmail primarily so that failed mail can be saved to a user’s ~/dead.letter file. It can also be used (through use of aliases) to deliver mail to other files, but that use is less than optimal, as you will see.

To deliver to a file, sendmail first performs a fork(2) and gives the child the task of delivery. The fork is necessary so that sendmail can change its effective uid and gid, as we will show. The child then performs a stat(3) on the file. If the file exists, its file permissions are saved for later use. If it doesn’t exist, the saved permissions are defaulted to 0600. Under V8.7, the decision to use stat(2) versus lstat(2) to obtain the permissions ...

Get sendmail, 4th 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.