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