xref: /openbsd-src/usr.sbin/smtpd/forward.5 (revision 6b028660f0d8e189ee364e67b0d6f99698b5f2d6)
1.\"	$OpenBSD: forward.5,v 1.12 2024/09/05 06:33:04 jmc Exp $
2.\"
3.\" Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: September 5 2024 $
18.Dt FORWARD 5
19.Os
20.Sh NAME
21.Nm forward
22.Nd email forwarding information file
23.Sh DESCRIPTION
24Users may put a
25.Nm .forward
26file in their home directory.
27If this file exists,
28.Xr smtpd 8
29forwards email to the destinations specified therein.
30.Pp
31A
32.Nm .forward
33file contains a list of expansion values, as described in
34.Xr aliases 5 .
35Each expansion value should be on a line by itself.
36Expansion is performed under the user ID of the
37.Nm .forward
38file owner.
39.Pp
40Permissions on the
41.Nm .forward
42file are very strict and expansion is rejected if the file is
43group or world-writable;
44if the home directory is group writeable;
45or if the file is not owned by the user.
46.Pp
47Users should avoid editing the
48.Nm .forward
49file directly, to prevent delivery failures from occurring if a message
50arrives while the file is not fully written.
51The best option is to use a temporary file and use the
52.Xr mv 1
53command to atomically overwrite the former
54.Nm .forward .
55Alternatively, setting the
56.Xr sticky 8
57bit on the home directory will cause the
58.Nm .forward
59lookup to return a temporary failure, causing mails to be deferred.
60.Sh FILES
61.Bl -tag -width "~/.forwardXXX" -compact
62.It Pa ~/.forward
63Email forwarding information.
64.El
65.Sh EXAMPLES
66The following file forwards mail to
67.Dq user@example.com ,
68and pipes the same mail to
69.Dq examplemda .
70.Bd -literal -offset indent
71# empty lines are ignored
72
73user@example.com	# anything after # is ignored
74"|/path/to/examplemda"
75.Ed
76.Sh SEE ALSO
77.Xr aliases 5 ,
78.Xr smtpd 8
79.Sh CAVEATS
80The pipe
81.Sq |
82and :include: mechanisms are not allowed for the root user.
83