Updated sendfiles(1) man page to reflect upcoming code update.
[mmh] / man / mhmail.man
1 .\"
2 .\" %nmhwarning%
3 .\"
4 .TH MHMAIL %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
5 .SH NAME
6 mhmail \- send or read mail
7 .SH SYNOPSIS
8 .HP 5
9 .na
10 .B mhmail
11 .RB [ \-to ]
12 .RI addrs
13 \&...
14 .RB [ \-attach
15 .IR file ]
16 .RB [ \-body
17 .IR text ]
18 .RB [ \-cc
19 .I addrs
20 \&...]
21 .RB [ \-from
22 .IR addr ]
23 .RB [ \-headerfield
24 .IR name:value ]
25 .RB [ \-subject
26 .IR subject ]
27 .RB [ \-resent ]
28 [switches\ for
29 .I post
30 \&... |
31 .RB \-profile
32 [switches\ for
33 .I send
34 \&...]]
35 .RB [ \-send " | " \-nosend ]
36 .RB [ \-version ]
37 .RB [ \-help ]
38 .PP
39 .HP 5
40 .B mhmail
41 with no arguments is equivalent to
42 .B inc
43 .ad
44 .SH DESCRIPTION
45 .B mhmail
46 is intended as a replacement for the standard Berkeley
47 mail program
48 .RB ( mail
49 or
50 .BR mailx ),
51 which is compatible with
52 .BR nmh .
53 This program is intended for the use of programs such as
54 .BR cron ,
55 which expect to send mail automatically to various addresses.  It is
56 also used by various
57 .B nmh
58 commands to mail various
59 error notifications.  Although
60 .B mhmail
61 can be used interactively,
62 it is recommended that
63 .B comp
64 and
65 .B send
66 be used instead to send messages.
67 .PP
68 When invoked without arguments, it simply invokes
69 .B inc
70 to incorporate new messages from the user's maildrop.
71 .PP
72 When one or more addresses are specified, a message is read from the
73 standard input and spooled to a temporary file.
74 .B mhmail
75 then invokes
76 .BR post ,
77 by default, with the name of the temporary file as its argument to
78 deliver the message to the specified address.
79 .PP
80 The
81 .B \-subject
82 .I subject
83 switch can be used to specify the
84 \*(lqSubject:\*(rq field of the message.
85 .PP
86 The
87 .B \-resent
88 switch indicates that the message body is a fully formed message that
89 will be resent, as
90 .B dist
91 would do.  For example:
92 .PP
93 .RS 5
94 .nf
95 mhmail u2@example.com -resent < `mhpath cur`
96 .fi
97 .RE
98 .PP
99 By default,
100 .B mhmail
101 will read the message to be sent from the
102 standard input.  You can specify the text of the message at the command
103 line with the
104 .B \-body
105 .I text
106 switch.  If the standard input has zero
107 length,
108 .B mhmail
109 will not send the message and return with status 1.  You can use the switch
110 .B \-body
111 \*(lq\*(rq to force an empty message.
112 .PP
113 Normally, addresses appearing as arguments are put in the \*(lqTo:\*(rq
114 field.  At least one such address is required when sending a message,
115 i.e., if any other switches are supplied. If the
116 .B \-cc
117 switch is used, all addresses following it, even if there are
118 intervening switches other than
119 .BR \-to ,
120 are placed in the \*(lqcc:\*(rq field.  The optional
121 .B \-to
122 switch can appear in front of any addresses to signify their placement
123 in the \*(lqTo:\*(rq field.  The
124 .B \-to
125 and
126 .B \-cc
127 switches may be given multiple times.
128 .PP
129 By using
130 .B \-from
131 .IR addr ,
132 you can specify the \*(lqFrom:\*(rq header of
133 the draft.  If no
134 .B \-from
135 switch is used when sending,
136 .B mhmail
137 will supply a \*(lqFrom:\*(rq header field using the sender's local mailbox,
138 see
139 .I localmbox
140 in
141 .BR mh-format (5).
142 Naturally,
143 .B post
144 will fill\-in the \*(lqSender:\*(rq
145 header correctly.
146 .PP
147 The
148 .B \-headerfield
149 .I name:value
150 switch adds a header field with the specified name and value to the
151 message.  (The
152 .I value
153 is called the
154 .I field body
155 in RFC 2822, but that's too easily confused with the message body.)
156 There need not be a space after the colon that separates the
157 name and value in the argument to this switch.  It is usually best to
158 enclose the argument in quotes to protect it from the shell.  The
159 .B \-headerfield
160 switch may be given multiple times to add multiple header fields,
161 for example,
162 .PP
163 .RS 5
164 .nf
165 mhmail -from sender@example.com \\
166 -headerfield 'MIME-Version:1.0' \\
167 -headerfield 'Content-Type:text/plain; charset=utf-8' \\
168 -headerfield 'Content-Transfer-Encoding:8bit' \\
169 recipient@example.com
170 .fi
171 .RE
172 .PP
173 Note about this example:  the
174 .B \-attach
175 switch causes
176 .I MIME-Version
177 and
178 .I Content-Type
179 headers to be added to the message.
180 .PP
181 The
182 .B \-profile
183 switch instructs
184 .B mhmail
185 to use
186 .B send
187 instead of
188 .B post
189 to send the message.  This allows use of the user's context and aliases.
190 .PP
191 The
192 .B \-attach
193 .I file
194 switch attaches the specified file to the message.  Use of
195 .B \-attach
196 enables
197 .B \-profile
198 because
199 .B mhmail
200 uses
201 .B send
202 to handle the attachment.  It is usually best to enclose the argument
203 in quotes to protect it from the shell.  The
204 .B \-attach
205 switch may be given multiple times to add multiple attachments.
206 .PP
207 The
208 .B \-nosend
209 option shows the draft file that would be posted/sent on the command's
210 standard output but does not post or send it.
211 .B \-send
212 provides the default behavior of posting or sending the message.  It
213 can be used to disable
214 .BR \-nosend ,
215 for example, when using a shell alias.
216 .PP
217 All other switches are passed on to
218 .B post
219 if
220 .B \-profile
221 is not used, or
222 .B send
223 if
224 .B \-profile
225 is used.
226
227 .SH FILES
228 .fc ^ ~
229 .nf
230 .ta \w'%etcdir%/ExtraBigFileName  'u
231 ^%bindir%/inc~^Program to incorporate maildrop into folder
232 ^%libdir%/post~^Program to deliver a message
233 ^/tmp/mhmail*~^Temporary copy of message
234 .fi
235
236 .SH "SEE ALSO"
237 dist(1), inc(1), mh-format(5), post(8), send(1)
238
239 .SH DEFAULTS
240 .nf
241 .RB ` "\-from localmbox" '
242 .RB ` \-profile "' is enabled by default only with " \-attach
243 .RB ` \-send '
244 .fi
245
246 .SH CONTEXT
247 If
248 .B inc
249 is invoked, then
250 .BR inc 's
251 context changes occur.  With the
252 .B \-profile
253 switch, the context of
254 .B send
255 is used.
256 .B mhmail
257 does not read the context file itself, so an entry for it will be
258 ignored.