1SEND(1) General Commands Manual SEND(1)
2
3
4
6 send - send an nmh message
7
9 send [-help] [-version] [-alias aliasfile] [-draft] [-draftfolder
10 +folder] [-draftmessage msg] [-nodraftfolder] [-filter filterfile]
11 [-nofilter] [-format | -noformat] [-forward | -noforward] [-mime |
12 -nomime] [-msgid | -nomsgid] [-messageid localname | random]
13 [-push | -nopush] [-verbose | -noverbose] [-watch | -nowatch]
14 [-mts smtp | sendmail/smtp | sendmail/pipe] [-sendmail program]
15 [-server servername] [-port port-name/number] [-sasl] [-nosasl]
16 [-saslmech mechanism] [-authservice service] [-snoop] [-user user‐
17 name] [-tls] [-initialtls] [-notls] [-certverify] [-nocertverify]
18 [-width columns] [file ...]
19
21 send will cause each of the specified files to be delivered to each of
22 the destinations in the “To:”, “cc:”, “Bcc:”, “Dcc:”, and “Fcc:” fields
23 of the message. If send is re-distributing a message, as invoked from
24 dist, then the corresponding “Resent-xxx” fields are examined instead.
25
26 By default, send uses the program post to do the actual delivery of the
27 messages, although this can be changed by defining the postproc profile
28 component. Most of the features attributed to send are actually per‐
29 formed by post.
30
31 Before send gives the message to post for delivery, the message is pro‐
32 cessed by mhbuild to perform any necessary MIME encoding of the outgo‐
33 ing message. This can be changed by the buildmimeproc profile compo‐
34 nent. mhbuild is invoked with the -auto switch, so mhbuild directives
35 are not processed by default. See mhbuild(1) for more information.
36
37 mhbuild will scan the message draft for a header named Attach. The
38 draft is converted to a MIME message if one or more matches are found.
39 This conversion occurs before all other processing. whatnow(1) de‐
40 scribes the user interface for managing MIME attachments via this mech‐
41 anism.
42
43 The first part of the MIME message is the draft body if that body con‐
44 tains any non-blank characters. The body of each Attach header field
45 is interpreted as a file name, and each file named is included as a
46 separate part in the MIME message.
47
48 Determination of the content MIME type inserted into the Content-Type
49 header for each part depends on how the nmh installation was config‐
50 ured. If a program, such as file with a --mime or -i option, was found
51 that can specify the type of a file as a MIME type string, then that
52 will be used. To determine if your nmh was so configured, run mhparam
53 mimetypeproc and see if a non-empty string is displayed.
54
55 If your nmh was not configured with a program to specify a file type as
56 a MIME string, then a different method is used to determine the con‐
57 tent-type string. This method is also used if the configured mimetype‐
58 proc fails to find the MIME type of the content. For file names with
59 dot suffixes, the profile is scanned for a mhshow-suffix- entry for
60 that suffix. The content-type for the part is taken from that profile
61 entry if a match is found. If a match is not found in the user pro‐
62 file, the mhn.defaults profile is scanned next. If no match is found
63 or the file does not have a dot suffix, the content-type is text/plain
64 if the file contains only ASCII characters or application/octet-stream
65 if it contains characters outside of the ASCII range. See mhshow(1)
66 for more details and example syntax.
67
68 Each attached MIME part contains a “Content-Description” header that
69 includes the filename, and adds a “Content-Disposition” header. Here
70 is an example of MIME part headers for an attachment:
71
72 Content-Type: text/plain; name="VERSION"; charset="us-ascii"
73 Content-Description: VERSION
74 Content-Disposition: attachment; filename="VERSION"
75
76 See mhbuild(1) for explanation of how the Content-Disposition value is
77 selected.
78
79 If -push is specified, send will detach itself from the user's terminal
80 and perform its actions in the background. If push'd and the draft
81 can't be sent, then an error message will be sent (using the mailproc)
82 back to the user. If -forward is given, then a copy of the draft will
83 be attached to this failure notice. Using -push differs from putting
84 send in the background because the output is trapped and analyzed by
85 nmh.
86
87 If -verbose is specified, send will indicate the interactions occurring
88 with the transport system, prior to actual delivery. If -watch is
89 specified send will monitor the delivery of local and network mail.
90 Hence, by specifying both switches, a large detail of information can
91 be gathered about each step of the message's entry into the transport
92 system.
93
94 The -draftfolder +folder and -draftmessage msg switches invoke the nmh
95 draft folder facility. This is an advanced (and highly useful) fea‐
96 ture. Consult mh-draft(5) for more information.
97
98 send with no file argument will query whether the draft is the intended
99 file, whereas -draft will suppress this question. Once the transport
100 system has successfully accepted custody of the message, the file will
101 be renamed with a site-dependent prefix (usually a comma), which allows
102 it to be retrieved until the next draft message is sent. If there are
103 errors in the formatting of the message, send will abort with a (hope‐
104 fully) helpful error message.
105
106 If a “Bcc:” field is encountered, its addresses will be used for deliv‐
107 ery, and the “Bcc:” field will be removed from the message sent to
108 sighted recipients. The blind recipients will receive an entirely new
109 message with a minimal set of headers. The body of this new message
110 will contain a copy of the message sent to the sighted recipients, ei‐
111 ther marked up with the indicator text "Blind-Carbon-Copy" or encapsu‐
112 lated as a MIME digest.
113
114 If a “Dcc:” field is encountered and the sendmail/pipe mail transport
115 method is not in use, its addresses will be used for delivery, and the
116 “Dcc:” field will be removed from the message. The blind recipients
117 will receive exactly the same message as the sighted recipients.
118 *WARNING* Recipients listed in the “Dcc:” field receive no explicit in‐
119 dication that they have received a “blind copy”. This can cause blind
120 recipients to inadvertently reply to all of the sighted recipients of
121 the original message, revealing that they received a blind copy. On
122 the other hand, since a normal reply to a message sent via a “Bcc:”
123 field will generate a reply only to the sender of the original message,
124 it takes extra effort in most mailers to reply to the included message,
125 and so would usually only be done deliberately, rather than by acci‐
126 dent.
127
128 If the sendmail/pipe mail transport method is used, then messages con‐
129 taining a “Dcc:” field are rejected.
130
131
132 If -filter filterfile is specified, then this copy is filtered (re-for‐
133 matted) by mhl prior to being sent to the blind recipients. Alter‐
134 nately, if you specify the -mime switch, then send will use the MIME
135 rules for encapsulation.
136
137 Prior to sending the message, the “Date: now” field will be appended to
138 the headers in the message. If -msgid is specified, then a “Mes‐
139 sage-ID:” field will also be added to the message.
140
141 The -messageid switch selects the style used for the part appearing af‐
142 ter the @ in “Message-ID:”, “Resent-Message-ID:”, and “Content-ID:”
143 header fields. The two acceptable options are localname (which is the
144 default), and random. With localname, the local hostname is used.
145 With random, a random sequence of characters is used instead. Note
146 that the -msgid switch must be enabled for this switch to have any ef‐
147 fect.
148
149 If send is re-distributing a message (when invoked by dist), then “Re‐
150 sent-” will be prepended to each of these fields: “From:”, “Date:”, and
151 “Message-ID:”.
152
153 A “From:” field is required for all outgoing messages. Multiple ad‐
154 dresses are permitted in the “From:” field, but a “Sender:” field is
155 required in this case. Otherwise a “Sender:” field is optional.
156
157 If a message with multiple “From:” addresses does not include a
158 “Sender:” field but does include an “Envelope-From:” field, the “Enve‐
159 lope-From:” field will be used to construct a “Sender:” field.
160
161 When using SMTP for mail submission, the envelope-from used for the
162 SMTP transaction is derived from the “Envelope-From:” field. If no
163 “Envelope-From:” field is present, the “Sender:” field is used. If
164 neither the “Envelope-From:” nor the “Sender:” field is present, the
165 “From:” field is used. When “Envelope-From:” appears in a message it
166 will be removed from the final outgoing message.
167
168 By using the -format switch, each of the entries in the “To:” and “cc:”
169 fields will be replaced with “standard” format entries. This standard
170 format is designed to be usable by all of the message handlers on the
171 various systems around the Internet. If -noformat is given, then head‐
172 ers are output exactly as they appear in the message draft.
173
174 If an “Fcc: folder” is encountered, the message will be copied to the
175 specified folder for the sender in the format in which it will appear
176 to any non-Bcc receivers of the message. That is, it will have the ap‐
177 pended fields and field reformatting. The “Fcc:” fields will be re‐
178 moved from all outgoing copies of the message.
179
180 Beware that if an “Fcc:” with one or more folders is present but none
181 of the folders exist, and the default fileproc and postproc are in use,
182 then refile will prompt the user to create the folder(s) if -push is
183 not specified. If all responses are negative, or creation of each
184 folder fails, or -push is specified, the message will not be copied to
185 any folder and will be removed by post. With the default refile
186 switches, the message draft will be renamed according to the specifica‐
187 tion of its -nolink switch.
188
189 By using the -width columns switch, the user can direct send as to how
190 long it should make header lines containing addresses.
191
192 The mail transport system default is provided in /etc/nmh/mts.conf but
193 can be overridden here with the -mts switch.
194
195 If nmh is using sendmail/pipe or sendmail/smtp as its mail transport
196 system, the -sendmail switch can be used to override the default send‐
197 mail program.
198
199 If nmh is using the SMTP MTA, the -server and the -port switches can be
200 used to override the default mail server (defined by the
201 /etc/nmh/mts.conf servers entry). The -snoop switch can be used to
202 view the SMTP transaction. (Beware that the SMTP transaction may con‐
203 tain authentication information either in plaintext or easily decoded
204 base64.) If -sasl -saslmech xoauth2 is used, the HTTP transaction is
205 also shown.
206
207 If nmh has been compiled with SASL support, the -sasl and -nosasl
208 switches will enable and disable the use of SASL authentication with
209 the SMTP MTA. Depending on the SASL mechanism used, this may require
210 an additional password prompt from the user (but the netrc file can be
211 used to store this password, as described in mh-profile(5). The
212 -saslmech switch can be used to select a particular SASL mechanism, and
213 the -user switch can be used to select a authorization userid to pro‐
214 vide to SASL other than the default. The credentials profile entry in
215 mh-profile(5) describes the ways to supply a username and password.
216
217 If SASL authentication is successful, nmh will attempt to negotiate a
218 security layer for session encryption. Encrypted data is labelled with
219 `(encrypted)' and `(decrypted)' when viewing the SMTP transaction with
220 the -snoop switch; see post(8)'s description of -snoop for its other
221 features.
222
223 If nmh has been compiled with OAuth support, the -sasl and -saslmech
224 xoauth2 switches will enable OAuth authentication. The -user switch
225 must be used, and the username must be an email address the user has
226 for the service, which must be specified with the -authservice service
227 switch. Before using OAuth authentication, the user must authorize nmh
228 by running mhlogin and grant authorization to that account. See mhlo‐
229 gin(1) for more details.
230
231 If nmh has been compiled with TLS support, the -tls and -initialtls
232 switches will require the negotiation of TLS when connecting to the
233 SMTP MTA. The -tls switch will negotiate TLS as part of the normal
234 SMTP protocol using the STARTTLS command. The -initialtls will negoti‐
235 ate TLS immediately after the connection has taken place, before any
236 SMTP commands are sent or received. Encrypted data is labelled with
237 `(tls-encrypted)' and `(tls-decrypted)' when viewing the SMTP transac‐
238 tion with the -snoop switch; see post(8)'s description of -snoop for
239 its other features. The -notls switch will disable all attempts to ne‐
240 gotiate TLS.
241
242 If port 465 is specified and none of the TLS switches were enabled,
243 -initialtls will be implied if TLS support was compiled in. Though
244 port 465 for SMTPS (SMTP over SSL) was deregistered by IANA in 1998, it
245 is still used for that service.
246
247 When using TLS the default is to verify the remote certificate and Sub‐
248 jectName against the local trusted certificate store. This can be con‐
249 trolled by the -certverify and -nocertverify switches. See your
250 OpenSSL documentation for more information on certificate verification.
251
252 The files specified by the profile entry “Aliasfile:” and any addi‐
253 tional alias files given by the -alias aliasfile switch will be read
254 (more than one file, each preceded by -alias, can be named). See
255 mh-alias(5) for more information.
256
257 Selection based on sender address: sendfrom
258 One or more sendfrom profile components can be used to select a mail
259 server address, mail server port, or any other switch that can be sup‐
260 plied to post. It works by first looking at the sender address and do‐
261 main name in the message draft, as described below. It then looks for
262 a corresponding profile entry, which contains the post switches. To
263 enable, add profile entries of the form:
264
265 sendfrom-address/domain name: post switches
266
267 The email address is extracted from the Envelope-From: header, if not
268 blank, the Sender: header, or the From: header line in the message
269 draft. Multiple profile entries, with different email addresses or do‐
270 main names, are supported. This allows different switches to post,
271 such as -user, to be associated with different email addresses. If a
272 domain name is used, it matches all users in that domain.
273
274 Here is an example profile entry to use the SMTP on the localhost when
275 the sender address is clearly local:
276
277 sendfrom-localuser@localhost: -server localhost -port smtp
278
279 (Indentation indicates a continued line, as supported in MH profiles.)
280 The username need not be the same as the sender address, which was ex‐
281 tracted from the appropriate header line as noted above.
282
283 Here are example profile entries that use an nmh credentials file:
284
285 credentials: file:nmhcreds
286 sendfrom-sendgrid_address@example.com: -sasl -tls
287 -server smtp.sendgrid.net
288 sendfrom-outbound.att.net: -sasl -initialtls
289 -server outbound.att.net -port 465
290 sendfrom-fastmail.com: -initialtls -sasl -saslmech LOGIN
291 -server smtps-proxy.messagingengine.com -port 80
292
293 where nmhcreds is in the user's nmh directory (from the Path profile
294 component) and contains:
295
296 machine smtp.sendgrid.net
297 login sendgrid_login@example.com
298 password ********
299 machine outbound.att.net
300 login att_login@example.com
301 password ********
302 machine smtps-proxy.messagingengine.com
303 login fastmail_login@example.com
304 password ********
305
306 For more information on authentication to mail servers, see mhlogin(1)
307 for OAuth services, and mh-profile(5) for login credentials.
308
310 $HOME/.mh_profile The user profile
311
313 Path: To determine the user's nmh directory
314 Aliasfile: For a default alias file
315 Signature: To determine the user's mail signature
316 mailproc: Program to post failure notices
317 postproc: Program to post the message
318 sendfrom-address: Switches to post for sender address
319 sendfrom-domain: Switches to post for sender domain name
320
322 comp(1), dist(1), file(1), forw(1), mhbuild(1), mhparam(1), mhlogin(1),
323 refile(1), repl(1), whatnow(1), mh-alias(5), mh-profile(5), mh-tai‐
324 lor(5), post(8)
325
327 `file' defaults to <mh-dir>/draft
328 `-alias' defaults to /etc/nmh/MailAliases
329 `-nodraftfolder'
330 `-nofilter'
331 `-format'
332 `-forward'
333 `-nomime'
334 `-nomsgid'
335 `-messageid localname'
336 `-nopush'
337 `-noverbose'
338 `-nowatch'
339 `-width 72'
340 `-certverify'
341
343 None
344
346 Under some configurations, it is not possible to monitor the mail de‐
347 livery transaction; -watch is a no-op on those systems.
348
349
350
351nmh-1.8 2022-12-22 SEND(1)