summaryrefslogtreecommitdiff
path: root/imap/src/tmail/tmail.1
blob: a34d4bb9df67c5441c2363b7577d282cb59e9964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
.ig
 * ========================================================================
 * Copyright 1988-2007 University of Washington
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * 
 * ========================================================================
..
.TH TMAIL 1 "September 27, 2007"
.SH NAME
tmail \- Mail Delivery Module
.nh
.SH SYNOPSIS
.B tmail
.I [-b format] [\-D] [-f from_name] [\-I inbox_specifier] user[+folder] ...
.SH DESCRIPTION
.I tmail
delivers mail to a user's INBOX or a designated folder.
.I tmail
may be configured as a drop-in replacement for
.IR binmail (1),
.IR mail.local (1)
or any program intended for use for mail delivery by a mail delivery program
such as
.IR sendmail (8).
.PP
.I tmail
is intended to be used for direct delivery by the mailer daemon;
.IR dmail (1)
is the preferred tool for user applications, e.g. a mail delivery
filter such as
.IR procmail (1) .
If
.I tmail
is used for a user application,
then the calling program must be aware of the restrictions noted below.
.PP
When
.I tmail
exits, it returns exit status values to enable the mail delivery program
to determine whether a message was delivered successfully or had a
temporary (requeue for later delivery) or permanent (return to sender)
failure.
.PP
If the 
.I +folder
extension is included in the user argument, 
.I tmail
will attempt to deliver to the designated folder.  If the folder does not 
exist or the extension is not included, the message is delivered to the 
user's INBOX.
If delivery is to INBOX and no INBOX currently exists,
.I tmail
will create a new INBOX, using the \fB-I\fR or \fB-b\fR flag if specified.
.I tmail
recognizes the format of an existing INBOX or folder, and appends the new
message in that format.
.PP
The \fB-b\fR flag specifies a format to create INBOX if INBOX does not
already exist.  This flag requires privileges, and can not be used with
\fB-I\fR.  The argument is
a format name such as mix, mbx, etc.
.PP
The \fB-D\fR flag specifies debugging; this enables additional message
telemetry.
.PP
The \fB-f\fR or \fB-r\fR flag is used by
the mail delivery program to specify a Return-Path.  The header
.br
   Return-Path: <\fIfrom_name\fR> 
.br 
is prepended to the message before delivery.  
.PP
The \fB-I\fR flag is used by the mail delivery program
to specify an alternative INBOX name.  This flag requires privileges,
and can not be used with \fB-b\fR.  This affects the location and format
of INBOX.  If specified, it should be in one of three forms:
.sp
The first form of argument to \fB-I\fR is the string "INBOX", which
means to write to the system default inbox using the system default
mailbox format.  These system defaults are defined when the c-client
library is built.
.sp
The second form of argument to \fB-I\fR is a delivery specification,
consisting of "#driver.", a c-client mailbox format driver name, "/",
and a file name.  This will write to the specified file in the
specified format.  For example, #driver.mbx/INBOX will write to file
"INBOX" in the home directory in mbx format; and
#driver.unix/mail/incoming will write to file "incoming" in the
user's "mail" subdirectory in unix (default UNIX) format.
.sp
The third form of argument to \fB-I\fR is any other name.  Normally,
this will write to the specified file on the user's home directory in
the specified format.  However, certain names are special.  These are:
.PP
.nf
  value       equivalant to
  -----       -------------
  INBOX.MTX   #driver.mtx/INBOX.MTX
  mbox        #driver.unix/mbox
  mail.txt    #driver.tenex/mail.txt
.fi
.PP
If \fB-I\fR is not specified, the default action is \fB-I INBOX\fR.
.PP
If multiple recipients are specified on the command line,
.I tmail
spawns one child process per recipient to perform actual delivery.  This
way of calling
.I tmail
is not recommended; see below under
.IR RESTRICTIONS .
.SH INSTALLATION
If 
.I tmail
is to be used for mail delivery from the mail delivery program, it 
.I must
be installed setuid root.
.sp
If sendmail is the mail delivery program,
.I tmail
is invoked from sendmail.cf.  Look for the "Mlocal" line, and substitute
the path name for the
.I tmail
binary in place of /bin/mail, /usr/lib/mail.local, etc.  You should also
add the flag to invoke
.I tmail
with CRLF style newlines; this is usually done with E=\\r\\n in the Mlocal
line.
.sp
Here is an example of an Mlocal line in sendmail version 8:
.sp
.nf
Mlocal, P=/usr/local/etc/tmail, F=lsDFMAw5:/|@qPrn+,
  S=10/30, R=20/40, E=\\r\\n, T=DNS/RFC822/X-Unix,
  A=tmail $u
.fi
.PP
If
.I tmail
is to be called with the \fB-I\fR flag, it must be invoked with both
real and effective UID root.  Many sendmail configurations invoke the
local mailer as the sending user when that user is local, which
will prevent \fB-b\fR or \fB-I\fR from working.
.SH SECURITY CONSIDERATIONS
If
.I tmail
is invoked by an ordinary user, the Received: header line will
indicate the name or UID of the user that invoked it.
.PP
Ordinary users are not permitted to use the \fB-b\fR or \fB-I\fR flag since
otherwise a user could create any file on another user's directory.
.PP
.I tmail
can deliver mail to home directories.  In addition,
.I tmail
can be used to deliver mail to other mail folders in a home directory
or an inferior directory of a home directory.
.SH RESTRICTIONS
The calling program should invoke
.I tmail
with CRLF newlines, otherwise
.I tmail
will complain in syslog.
.PP
Absolute pathnames and 
.I ~user
specifications are not permitted in
.I +folder
extensions.
.PP
Ordinary users are not permitted to use the \fB-I\fR flag.
.PP
IMAP4 namespace names are not yet supported in 
.I +folder
extensions.
.PP
It is not possible to use
.I tmail
to deliver to
.IR mh (1)
format mailboxes.
.PP
If delivery to multiple users is specified and delivery to any single user
fails, the entire delivery will be reported as having failed, even though
delivery to other users may have succeeded.  If
.I tmail
is used for mail delivery from
.IR sendmail (8),
a separate tmail invocation should be done for each user.  Otherwise a
delivery failure for a single user in a message going to multiple users
will cause multiple deliveries to all the other users every time
.IR sendmail (8),
retries.
.SH AUTHOR
Mark Crispin, MRC@CAC.Washington.EDU
.SH "SEE ALSO"
binmail(1)
.br
sendmail(8)