1.\" $OpenBSD: mail.local.8,v 1.29 2010/09/03 11:35:08 jmc Exp $ 2.\" Copyright (c) 1990 The Regents of the University of California. 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 3. Neither the name of the University nor the names of its contributors 14.\" may be used to endorse or promote products derived from this software 15.\" without specific prior written permission. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\" 29.\" from: @(#)mail.local.8 6.8 (Berkeley) 4/27/91 30.\" 31.Dd $Mdocdate: March 23 2014 $ 32.Dt MAIL.LOCAL 8 33.Os 34.Sh NAME 35.Nm mail.local 36.Nd store mail in a mailbox 37.Sh SYNOPSIS 38.Nm mail.local 39.Op Fl Ll 40.Op Fl f Ar from 41.Ar user ... 42.Sh DESCRIPTION 43.Nm 44reads the standard input up to an end-of-file and appends it to each 45.Ar user Ns 's 46.Pa mail 47file. 48The 49.Ar user 50must be a valid user name. 51.Pp 52The options are as follows: 53.Bl -tag -width Ds 54.It Fl f Ar from 55Specify the sender's name. 56.It Fl L 57Don't create a 58.Pa username.lock 59file while locking the spool. 60.It Fl l 61For compatibility, request that files named 62.Pa username.lock 63be used for locking. 64(This is the default behavior.) 65.El 66.Pp 67Individual mail messages in the mailbox are delimited by an empty 68line followed by a line beginning with the string 69.Dq "From\&\ " . 70A line containing the string 71.Dq "From\&\ " , 72the sender's name and a timestamp is prepended to each delivered mail message. 73A blank line is appended to each message. 74A greater-than character 75.Pq Ql > 76is prepended to any line in the message which could be mistaken for a 77.Dq "From\&\ " 78delimiter line. 79.Pp 80Significant efforts have been made to ensure that 81.Nm 82acts as securely as possible if the spool directory is mode 1777 or 755. 83The default of mode 755 is more secure, but it prevents mail clients from using 84.Pa username.lock 85style locking. 86The use of 1777 is more flexible in an NFS shared-spool environment, 87so many sites use it. 88However, it does carry some risks, such as attackers filling the spool disk. 89Some of these problems may be alleviated 90by making the spool a separate filesystem, and placing quotas on it. 91The use of any mode other than 1777 and 755 for the spool directory is 92recommended against but may work properly. 93.Pp 94The mailbox is always locked using 95.Xr flock 2 96while mail is appended. 97Unless the 98.Fl L 99flag is specified, a 100.Pa username.lock 101file is also used. 102.Pp 103If the 104.Xr biff 1 105service is returned by 106.Xr getservbyname 3 , 107the biff server is notified of delivered mail. 108.Sh ENVIRONMENT 109.Bl -tag -width indent 110.It Ev TZ 111Used to set the appropriate time zone on the timestamp. 112.El 113.Sh FILES 114.Bl -tag -width /tmp/local.XXXXXXXXXX -compact 115.It Pa /tmp/local.XXXXXXXXXX 116temporary files 117.It Pa /var/mail/user 118user's mailbox directory 119.El 120.Sh EXIT STATUS 121.Ex -std mail.local 122.Sh SEE ALSO 123.Xr biff 1 , 124.Xr mail 1 , 125.Xr flock 2 , 126.Xr getservbyname 3 , 127.Xr comsat 8 , 128.Xr sendmail 8 129.Sh HISTORY 130A superset of 131.Nm 132(handling mailbox reading as well as mail delivery) appeared in 133.At v7 134as the program 135.Xr mail 1 . 136.Sh BUGS 137Since 138.Xr sendmail 8 139bases its idea of whether a message has been delivered or not 140on the return value from 141.Nm mail.local , 142using quotas in 143.Pa /var/mail 144can be problematic. 145By default, 146.Xr sendmail 8 147will ask 148.Nm 149to deliver a message to multiple recipients if possible. 150This causes problems in a quota environment since a message may be 151delivered to some users but not others due to disk quotas. 152Even though the message was delivered to some of the recipients, 153.Nm 154will exit with an exit code > 0, causing 155.Xr sendmail 8 156to attempt redelivery later. 157That means that some users will keep getting the same message every time 158.Xr sendmail 8 159runs its queue. 160.Pp 161If you are running with disk quotas on 162.Pa /var/mail 163it is imperative that you unset the 164.Dq m 165mailer flag for the 166.Sq local 167mailer. 168To do this, locate the line beginning with 169.Dq Mlocal 170in 171.Pa /etc/mail/sendmail.cf 172and remove the 173.Dq m 174from the flags section, denoted by 175.Dq F= . 176Alternately, you can override the default mailer flags by adding the line: 177.Pp 178.Dl define(`LOCAL_MAILER_FLAGS', `rn9S')dnl 179.Pp 180to your 181.Dq \.mc 182file (this is the source file that is used to generate 183.Pa /etc/mail/sendmail.cf ) . 184