3b382af276f1bfdb290990fb87d0edbd0830f4f2
[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 [ \-header\-field
23 .IR name:body ]
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.  If the
109 .B \-cc
110 switch is used, all addresses following it, even if there are
111 intervening switches, are placed in the \*(lqcc:\*(rq field.
112 .PP
113 By using
114 .B \-from
115 .IR addr ,
116 you can specify the \*(lqFrom:\*(rq header of
117 the draft.  If no
118 .B \-from
119 switch is used when sending,
120 .B mhmail
121 will supply a \*(lqFrom:\*(rq header field using the sender's local mailbox.
122 Naturally,
123 .B post
124 will fill\-in the \*(lqSender:\*(rq
125 header correctly.
126 .PP
127 The
128 .B \-header\-field
129 .I name:body
130 switch adds a header field with the specified name and body to the
131 message.  There need not be a space after the colon that separates the
132 name and body in the argument to this switch.  It is usually best to
133 enclose the argument in quotes to protect it from the shell.  The
134 .B \-header\-field
135 switch may be given multiple times to add multiple header fields,
136 for example,
137 .PP
138 .RS 5
139 .nf
140 mhmail -from sender@example.com \\
141 -header\-field 'MIME-Version:1.0' \\
142 -header\-field 'Content-Type:text/plain; charset=utf-8' \\
143 -header\-field 'Content-Transfer-Encoding:8bit' \\
144 recipient@example.com
145 .fi
146 .RE
147 .PP
148 Note about this example:  the
149 .B \-attach
150 switch causes
151 .I MIME-Version
152 and
153 .I Content-Type
154 headers to be added to the message.
155 .PP
156 The
157 .B \-profile
158 switch instructs
159 .B mhmail
160 to use
161 .B send
162 instead of
163 .B post
164 to send the message.  This allows use of the user's context and aliases.
165 .PP
166 The
167 .B \-attach
168 .I file
169 switch attaches the specified file to the message.  Use of
170 .B \-attach
171 enables
172 .B \-profile
173 because
174 .B mhmail
175 uses
176 .B send
177 to handle the attachment.  It is usually best to enclose the argument
178 in quotes to protect it from the shell.  The
179 .B \-attach
180 switch may be given multiple times to add multiple attachments.
181 .PP
182 The
183 .B \-nosend
184 option shows the draft file that would be posted/sent on the command's
185 standard output but does not post or send it.
186 .B \-send
187 provides the default behavior of posting or sending the message.  It
188 can be used to disable
189 .BR \-nosend ,
190 for example, when using a shell alias.
191 .PP
192 All other switches are passed on to
193 .B post
194 if
195 .B \-profile
196 is not used, or
197 .B send
198 if
199 .B \-profile
200 is used.
201
202 .SH FILES
203 .fc ^ ~
204 .nf
205 .ta \w'%etcdir%/ExtraBigFileName  'u
206 ^%bindir%/inc~^Program to incorporate maildrop into folder
207 ^%libdir%/post~^Program to deliver a message
208 ^/tmp/mhmail*~^Temporary copy of message
209 .fi
210
211 .SH "SEE ALSO"
212 dist(1), inc(1), post(8), send(1)
213
214 .SH DEFAULTS
215 .nf
216 .RB ` \-send '
217 .fi
218 .RB ` \-profile' ,
219 enabled by default only with
220 .B \-attach
221
222 .SH CONTEXT
223 If
224 .B inc
225 is invoked, then
226 .BR inc 's
227 context changes occur.  With the
228 .B \-profile
229 switch, the context of
230 .B send
231 is used.