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