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