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