]> diplodocus.org Git - nmh/blob - man/send.man
6c93f97f31e4cecd43a0fadf591cf4da8118f8ba
[nmh] / man / send.man
1 .TH SEND %manext1% 2017-05-11 "%nmhversion%"
2 .
3 .\" %nmhwarning%
4 .
5 .SH NAME
6 send \- send an nmh message
7 .SH SYNOPSIS
8 .HP 5
9 .na
10 .B send
11 .RB [ \-help ]
12 .RB [ \-version ]
13 .RB [ \-alias
14 .IR aliasfile ]
15 .RB [ \-draft ]
16 .RB [ \-draftfolder
17 .IR +folder ]
18 .RB [ \-draftmessage
19 .IR msg ]
20 .RB [ \-nodraftfolder ]
21 .RB [ \-filter
22 .IR filterfile ]
23 .RB [ \-nofilter ]
24 .RB [ \-format " | " \-noformat ]
25 .RB [ \-forward " | " \-noforward ]
26 .RB [ \-mime " | " \-nomime ]
27 .RB [ \-msgid " | " \-nomsgid ]
28 .RB [ \-messageid
29 .IR localname " | " random ]
30 .RB [ \-push " | " \-nopush ]
31 .RB [ \-split
32 .IR seconds ]
33 .RB [ \-verbose " | " \-noverbose ]
34 .RB [ \-watch " | " \-nowatch ]
35 .RB [ \-mts
36 .IR smtp " | " sendmail/smtp " | " sendmail/pipe ]
37 .RB [ \-sendmail
38 .IR program ]
39 .RB [ \-server
40 .IR servername ]
41 .RB [ \-port
42 .IR port-name/number ]
43 .RB [ \-sasl ]
44 .RB [ \-nosasl ]
45 .RB [ \-saslmech
46 .IR mechanism ]
47 .RB [ \-authservice
48 .IR service ]
49 .RB [ \-snoop ]
50 .RB [ \-user
51 .IR username ]
52 .RB [ \-tls ]
53 .RB [ \-initialtls ]
54 .RB [ \-notls ]
55 .RB [ \-certverify ]
56 .RB [ \-nocertverify ]
57 .RB [ \-width
58 .IR columns ]
59 .RB [ file
60 \&...]
61 .ad
62 .SH DESCRIPTION
63 .B send
64 will cause each of the specified files to be delivered
65 to each of the destinations in the \*(lqTo:\*(rq, \*(lqcc:\*(rq,
66 \*(lqBcc:\*(rq, \*(lqDcc:\*(rq, and \*(lqFcc:\*(rq fields of the message. If
67 .B send
68 is re-distributing a message, as invoked from
69 .BR dist ,
70 then the
71 corresponding \*(lqResent\-xxx\*(rq fields are examined instead.
72 .PP
73 By default,
74 .B send
75 uses the program
76 .B post
77 to do the actual
78 delivery of the messages, although this can be changed by defining the
79 .I postproc
80 profile component. Most of the features attributed to
81 .B send
82 are actually performed by
83 .BR post .
84 .PP
85 Before
86 .B send
87 gives the message to
88 .B post
89 for delivery, the message is processed by
90 .B mhbuild
91 to perform any necessary MIME encoding of the outgoing message. This
92 can be changed by the
93 .I buildmimeproc
94 profile component.
95 .B mhbuild
96 is invoked with the
97 .B \-auto
98 switch, so
99 .B mhbuild
100 directives are not processed by default. See
101 .IR mhbuild (1)
102 for more information.
103 .PP
104 .B mhbuild
105 will scan the message draft for a header named
106 .IR Attach .
107 The draft is converted to a MIME message if one or more matches are found.
108 This conversion occurs before all other processing. The
109 .IR whatnow (1)
110 man page describes the user interface for managing MIME attachments via
111 this mechanism.
112 .PP
113 The first part of the MIME message is the draft body if that body contains
114 any non-blank characters.
115 The body of each
116 .I Attach
117 header field is interpreted as a file name, and each file named is included as a separate
118 part in the MIME message.
119 .PP
120 Determination of the content MIME type inserted into the Content-Type
121 header for each part depends on how the
122 .B nmh
123 installation was configured. If a program, such as
124 .B file
125 with a
126 .B \-\-mime
127 or
128 .B \-i
129 option, was found that can specify the type of a file as a MIME type
130 string, then that will be used. To determine if your
131 .B nmh
132 was so configured, run
133 .B mhparam mimetypeproc
134 and see if a non-empty string is displayed.
135 .PP
136 If your
137 .B nmh
138 was not configured with a program to specify a file type as a MIME
139 string, then a different method is used to determine the content-type
140 string. For file names with dot suffixes, the profile is scanned for a
141 .I mhshow-suffix-
142 entry for that suffix.
143 The content-type for the part is taken from that profile entry if a match is
144 found. If a match is not found in the user profile, the mhn.defaults
145 profile is scanned next.
146 If no match is found or the file does not have a dot suffix, the content-type
147 is text/plain if the file contains only ASCII characters or application/octet-stream
148 if it contains characters outside of the ASCII range. See
149 .IR mhshow (1)
150 for more details and example syntax.
151 .PP
152 Each attached MIME part contains a
153 \*(lqContent-Description\*(rq header that includes the filename, and
154 adds a \*(lqContent-Disposition\*(rq header.
155 Here is an example of MIME part headers for an attachment:
156 .PP
157 .nf
158 Content-Type: text/plain; name="VERSION"; charset="us-ascii"
159 Content-Description: VERSION
160 Content-Disposition: attachment; filename="VERSION"
161 .fi
162 .PP
163 See
164 .IR mhbuild (1)
165 for explanation of how the Content-Disposition value is selected.
166 .PP
167 If
168 .B \-push
169 is specified,
170 .B send
171 will detach itself from the user's
172 terminal and perform its actions in the background. If
173 .BR push 'd
174 and the draft can't be sent, then an error message will be sent (using
175 the mailproc) back to the user. If
176 .B \-forward
177 is given, then a copy
178 of the draft will be attached to this failure notice. Using
179 .B \-push
180 differs from putting
181 .B send
182 in the background because the output is
183 trapped and analyzed by
184 .BR nmh .
185 .PP
186 If
187 .B \-verbose
188 is specified,
189 .B send
190 will indicate the interactions
191 occurring with the transport system, prior to actual delivery.
192 If
193 .B \-watch
194 is specified
195 .B send
196 will monitor the delivery of local
197 and network mail. Hence, by specifying both switches, a large detail
198 of information can be gathered about each step of the message's entry
199 into the transport system.
200 .PP
201 The
202 .B \-draftfolder
203 .I +folder
204 and
205 .B \-draftmessage
206 .I msg
207 switches invoke
208 the
209 .B nmh
210 draft folder facility. This is an advanced (and highly
211 useful) feature. Consult the
212 .IR mh-draft (5)
213 man page for more
214 information.
215 .PP
216 If
217 .B \-split
218 is specified,
219 .B send
220 will split the draft into one
221 or more partial messages prior to sending. This makes use of the
222 MIME features in
223 .BR nmh .
224 Note however that if
225 .B send
226 is
227 invoked under
228 .BR dist ,
229 then this switch is ignored\0--\0it makes
230 no sense to redistribute a message in this fashion. Sometimes you want
231 .B send
232 to pause after posting a partial message. This is usually
233 the case when you are running
234 .B sendmail
235 and expect to generate a
236 lot of partial messages. The argument to
237 .B \-split
238 tells it how long
239 to pause between postings.
240 .PP
241 .B send
242 with no
243 .I file
244 argument will query whether the draft
245 is the intended file, whereas
246 .B \-draft
247 will suppress this question.
248 Once the transport system has successfully accepted custody of the
249 message, the file will be renamed with a site-dependent prefix
250 (usually a comma), which allows
251 it to be retrieved until the next draft message is sent. If there are
252 errors in the formatting of the message,
253 .B send
254 will abort with a
255 (hopefully) helpful error message.
256 .PP
257 If a \*(lqBcc:\*(rq field is encountered, its addresses will be used for
258 delivery, and the \*(lqBcc:\*(rq field will be removed from the message
259 sent to sighted recipients. The blind recipients will receive an entirely
260 new message with a minimal set of headers. Included in the body of the
261 message will be a copy of the message sent to the sighted recipients.
262 .PP
263 If a \*(lqDcc:\*(rq field is encountered and the
264 .B sendmail/pipe
265 mail transport method is not in use, its addresses will be used for
266 delivery, and the \*(lqDcc:\*(rq field will be removed from the message. The
267 blind recipients will receive the same message sent to the sighted
268 recipients. *WARNING* Recipients listed in the \*(lqDcc:\*(rq field receive no
269 explicit indication that they have received a \*(lqblind copy\*(rq.
270 This can cause blind recipients to
271 inadvertently reply to all of the sighted recipients of the
272 original message, revealing that they received a blind copy.
273 On the other hand, since a normal reply to a message sent
274 via a \*(lqBcc:\*(rq field
275 will generate a reply only to the sender of the original message,
276 it takes extra effort in most mailers to reply to the included
277 message, and so would usually only be done deliberately, rather
278 than by accident.
279 .PP
280 If
281 .B \-filter
282 .I filterfile
283 is specified, then this copy is filtered
284 (re-formatted) by
285 .B mhl
286 prior to being sent to the blind recipients.
287 Alternately, if you specify the
288 .B -mime
289 switch, then
290 .B send
291 will
292 use the MIME rules for encapsulation.
293 .PP
294 Prior to sending the message, the \*(lqDate:\ now\*(rq field will be appended to the headers in the message.
295 If
296 .B \-msgid
297 is specified, then a \*(lqMessage\-ID:\*(rq field will also
298 be added to the message.
299 .PP
300 The
301 .B \-messageid
302 switch selects the style used for the part appearing after the @
303 in \*(lqMessage\-ID:\*(rq, \*(lqResent\-Message\-ID:\*(rq, and
304 \*(lqContent\-ID:\*(rq header fields. The two acceptable options are
305 .B localname
306 (which is the default),
307 and
308 .BR random .
309 With
310 .BR localname ,
311 the local hostname is used. With
312 .BR random ,
313 a random sequence of characters is used instead. Note that the
314 .B \-msgid
315 switch must be enabled for this switch to have any effect.
316 .PP
317 If
318 .B send
319 is re-distributing a message (when invoked by
320 .BR dist ),
321 then \*(lqResent\-\*(rq will be prepended to each of these
322 fields: \*(lqFrom:\*(rq, \*(lqDate:\*(rq, and \*(lqMessage\-ID:\*(rq.
323 .PP
324 A \*(lqFrom:\*(rq field is required for all outgoing messages. Multiple
325 addresses are permitted in the \*(lqFrom:\*(rq field, but a \*(lqSender:\*(rq
326 field is required in this case. Otherwise a \*(lqSender:\*(rq field
327 is optional.
328 .PP
329 If a message with multiple \*(lqFrom:\*(rq
330 addresses does
331 .I not
332 include a \*(lqSender:\*(rq field but does include an \*(lqEnvelope\-From:\*(rq
333 field, the \*(lqEnvelope\-From:\*(rq field will be used to construct
334 a \*(lqSender:\*(rq field.
335 .PP
336 When using SMTP for mail submission, the envelope-from used for the SMTP
337 transaction is derived from the \*(lqEnvelope\-From:\*(rq field.
338 If no \*(lqEnvelope\-From:\*(rq field is present, the \*(lqSender:\*(rq
339 field is used. If neither the \*(lqEnvelope\-From:\*(rq nor the
340 \*(lqSender:\*(rq field is present, the \*(lqFrom:\*(rq field is used.
341 When \*(lqEnvelope\-From:\*(rq appears in a message
342 it will be removed from the final outgoing message.
343 .PP
344 By using the
345 .B \-format
346 switch, each of the entries in the \*(lqTo:\*(rq
347 and \*(lqcc:\*(rq fields will be replaced with \*(lqstandard\*(rq
348 format entries. This standard format is designed to be usable by all
349 of the message handlers on the various systems around the Internet.
350 If
351 .B \-noformat
352 is given, then headers are output exactly as they appear
353 in the message draft.
354 .PP
355 If an \*(lqFcc:\ folder\*(rq is encountered, the message will be copied
356 to the specified folder for the sender in the format in which it will
357 appear to any non\-Bcc receivers of the message. That is, it will have
358 the appended fields and field reformatting. The \*(lqFcc:\*(rq fields
359 will be removed from all outgoing copies of the message.
360 .PP
361 Beware that if no \*(lqFcc:\*(rq folders exist and the default
362 .I fileproc
363 and
364 .I postproc
365 are in use, then
366 .B refile
367 will prompt the user to create the folder(s) if
368 .B \-push
369 is not specified. If all responses are negative, or creation of each folder
370 fails, or
371 .B \-push
372 is specified, the message will not be copied to any folder and will be
373 removed by
374 .BR post.
375 With the default
376 .B refile
377 switches, the message draft will be renamed according to the specification
378 of its
379 .B \-nolink
380 switch.
381 .PP
382 By using the
383 .B \-width
384 .I columns
385 switch, the user can direct
386 .B send
387 as to how long it should make header lines containing addresses.
388 .PP
389 The mail transport system default is provided in
390 .I %nmhetcdir%/mts.conf
391 but can be overridden here with the
392 .B \-mts
393 switch.
394 .PP
395 If nmh is using as its mail transport system
396 .BR sendmail/pipe ,
397 the
398 .B \-sendmail
399 switch can be used to override the default
400 .B sendmail
401 program.
402 .PP
403 If nmh is using the SMTP MTA, the
404 .B \-server
405 and the
406 .B \-port
407 switches can be used to override the default mail server (defined by the
408 .I %nmhetcdir%/mts.conf
409 .RI servers
410 entry). The
411 .B \-snoop
412 switch can be used to view the SMTP transaction. (Beware that the
413 SMTP transaction may contain authentication information either in
414 plaintext or easily decoded base64.) If
415 .B \-sasl \-saslmech xoauth2
416 is used, the HTTP transaction is also shown.
417 .PP
418 If
419 .B nmh
420 has been compiled with SASL support, the
421 .B \-sasl
422 and
423 .B \-nosasl
424 switches will enable and disable
425 the use of SASL authentication with the SMTP MTA. Depending on the
426 SASL mechanism used, this may require an additional password prompt from the
427 user (but the
428 .I netrc
429 file can be used to store this password, as described in the
430 mh-profile(5) man page). The
431 .B \-saslmech
432 switch can be used to select a particular SASL mechanism,
433 and the
434 .B \-user
435 switch can be used to select a authorization userid to provide to SASL
436 other than the default. The credentials profile entry in the
437 mh\-profile(5) man page describes the ways to supply a username and
438 password.
439 .PP
440 If SASL authentication is successful,
441 .BR nmh
442 will attempt to negotiate a security layer for session encryption.
443 Encrypted data is labelled with `(encrypted)' and `(decrypted)' when
444 viewing the SMTP transaction with the
445 .B \-snoop
446 switch; see the
447 .B post
448 man page description of
449 .B \-snoop
450 for its other features.
451 .PP
452 If
453 .B nmh
454 has been compiled with OAuth support, the
455 .B \-sasl
456 and
457 .B \-saslmech xoauth2
458 switches will enable OAuth authentication. The
459 .B \-user
460 switch must be used, and the
461 .I username
462 must be an email address the user has for the service, which must
463 be specified with the
464 .B \-authservice
465 .I service
466 switch. Before using OAuth authentication, the user must authorize nmh by
467 running
468 .B mhlogin
469 and grant authorization to that account. See the
470 .IR mhlogin (1)
471 man page for more details.
472 .PP
473 If
474 .B nmh
475 has been compiled with TLS support, the
476 .B \-tls
477 and
478 .B \-initialtls
479 switches will require the negotiation of TLS when
480 connecting to the SMTP MTA. The
481 .B \-tls
482 switch will negotiate TLS as part of the normal SMTP protocol
483 using the STARTTLS command. The
484 .B \-initialtls
485 will negotiate TLS immediately after the connection has
486 taken place, before any SMTP commands are sent or received. Encrypted data
487 is labelled with `(tls-encrypted)' and
488 `(tls-decrypted)' when viewing the SMTP transaction with the
489 .B \-snoop
490 switch; see the
491 .B post
492 man page description of
493 .B \-snoop
494 for its other features.
495 The
496 .B \-notls
497 switch will disable all attempts to negotiate TLS.
498 .PP
499 If port 465 is specified and none of the TLS switches were enabled,
500 .B \-initialtls
501 will be implied if TLS support was compiled in. Though port 465 for
502 SMTPS (SMTP over SSL) was deregistered by IANA in 1998, it is still
503 used for that service.
504 .PP
505 When using TLS the default is to verify the remote certificate and SubjectName
506 against the local trusted certificate store. This can be controlled by
507 the
508 .B \-certverify
509 and
510 .B \-nocertverify
511 switches. See your OpenSSL documentation for more information on certificate
512 verification.
513 .PP
514 The files specified by the profile entry \*(lqAliasfile:\*(rq and any
515 additional alias files given by the
516 .B \-alias
517 .I aliasfile
518 switch will be
519 read (more than one file, each preceded by
520 .BR \-alias ,
521 can be named).
522 See
523 .IR mh\-alias (5)
524 for more information.
525 .SS Selection based on sender address: sendfrom
526 One or more
527 .I sendfrom
528 profile components can be used to select a mail server address, mail server
529 port, or any other switch that can be supplied to
530 .BR post .
531 It works by first looking at the sender address and domain name in the
532 message draft, as described below.
533 It then looks for a corresponding profile entry, which contains the
534 .B post
535 switches.
536 To enable, add profile entries of the form:
537 .PP
538 .RS 5
539 .RI sendfrom- "address/domain name" : " post switches"
540 .RE
541 .PP
542 The email address is extracted from the Envelope-From: header, if not blank,
543 the Sender: header, or the From: header line in the message draft.
544 Multiple profile entries, with different email addresses or domain names, are
545 supported.
546 This allows different switches to
547 .BR post ,
548 such as -user, to be associated with different email addresses.
549 If a domain name is used, it matches all users in that domain.
550 .PP
551 Here is an example profile entry using OAuth for an account hosted by gmail:
552 .PP
553 .nf
554 .RS 5
555 sendfrom-gmail_address@example.com: -sasl -saslmech xoauth2
556 .RS 5
557 -authservice gmail -tls -server smtp.gmail.com
558 -user gmail_login@example.com
559 .RE
560 .RE
561 .fi
562 .PP
563 (Indentation indicates a continued line, as supported in MH profiles.)
564 The username need not be the same as the sender address, which was extracted
565 from the appropriate header line as noted above.
566 .PP
567 Here are example profile entries that use an nmh credentials file:
568 .PP
569 .nf
570 .RS 5
571 credentials: file:nmhcreds
572 sendfrom-sendgrid_address@example.com: -sasl -tls
573 .RS 5
574 -server smtp.sendgrid.net
575 .RE
576 sendfrom-outbound.att.net: -sasl -initialtls
577 .RS 5
578 -server outbound.att.net -port 465
579 .RE
580 sendfrom-fastmail.com: -initialtls -sasl -saslmech LOGIN
581 .RS 5
582 -server smtps-proxy.messagingengine.com -port 80
583 .RE
584 .RE
585 .fi
586 .PP
587 where nmhcreds is in the user's nmh directory (from the Path profile component)
588 and contains:
589 .PP
590 .nf
591 .RS 5
592 machine smtp.sendgrid.net
593 .RS 5
594 login sendgrid_login@example.com
595 password ********
596 .RE
597 machine outbound.att.net
598 .RS 5
599 login att_login@example.com
600 password ********
601 .RE
602 machine smtps-proxy.messagingengine.com
603 .RS 5
604 login fastmail_login@example.com
605 password ********
606 .RE
607 .RE
608 .fi
609 .PP
610 For more information on authentication to mail servers, see the
611 .IR mhlogin (1)
612 man page for OAuth services, and
613 .IR mh-profile (5)
614 man page for login credentials.
615 .PP
616 .SH FILES
617 .fc ^ ~
618 .nf
619 .ta \w'%nmhetcdir%/ExtraBigFileName 'u
620 ^$HOME/.mh_profile~^The user profile
621 .fi
622 .SH "PROFILE COMPONENTS"
623 .fc ^ ~
624 .nf
625 .ta 2.4i
626 .ta \w'ExtraBigProfileName 'u
627 ^Path:~^To determine the user's nmh directory
628 ^Draft\-Folder:~^To find the default draft-folder
629 ^Aliasfile:~^For a default alias file
630 ^Signature:~^To determine the user's mail signature
631 ^mailproc:~^Program to post failure notices
632 ^postproc:~^Program to post the message
633 ^sendfrom-address:~^Switches to post for sender address
634 ^sendfrom-domain:~^Switches to post for sender domain name
635 .fi
636 .SH "SEE ALSO"
637 .IR comp (1),
638 .IR dist (1),
639 .IR file (1),
640 .IR forw (1),
641 .IR mhbuild (1),
642 .IR mhparam (1),
643 .IR mhlogin (1),
644 .IR refile (1),
645 .IR repl (1),
646 .IR whatnow (1),
647 .IR mh\-alias (5),
648 .IR mh\-profile (5),
649 .IR mh\-tailor (5),
650 .IR post (8)
651 .SH DEFAULTS
652 .nf
653 .RB ` file "' defaults to <mh-dir>/draft"
654 .RB ` \-alias "' defaults to %nmhetcdir%/MailAliases"
655 .RB ` \-nodraftfolder '
656 .RB ` \-nofilter '
657 .RB ` \-format '
658 .RB ` \-forward '
659 .RB ` \-nomime '
660 .RB ` \-nomsgid '
661 .RB ` "\-messageid\ localname" '
662 .RB ` \-nopush '
663 .RB ` \-noverbose '
664 .RB ` \-nowatch '
665 .RB ` "\-width\ 72" '
666 .RB ` \-certverify '
667 .fi
668 .SH CONTEXT
669 None
670 .SH BUGS
671 Under some configurations, it is not possible to monitor the mail delivery
672 transaction;
673 .B \-watch
674 is a no-op on those systems.
675 .PP
676 Using
677 .B \-split
678 .I 0
679 doesn't work correctly.