-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnail.1
15806 lines (15760 loc) · 418 KB
/
nail.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\"@ nail.1 - S-nail(1) reference manual.
.\"
.\" Copyright (c) 2012 - 2020 Steffen (Daode) Nurpmeso <[email protected]>.
.\" SPDX-License-Identifier: ISC
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"--MKREL-START--
.\"@ S-nail v14.9.25 / 2024-06-27
.Dd June 27, 2024
.ds VV \\%v14.9.25
.\"--MKREL-END--
.\"--MKMAN-START--
.ds UU \\%S-NAIL
.ds UA \\%S-nail
.ds uA \\%s-nail
.ds UR \\%s-nail.rc
.ds ur \\%~/.mailrc
.ds VD \\%~/dead.letter
.ds VM \\%~/mbox
.ds VN \\%~/.netrc
.ds VT \\%/tmp
.ds vS /etc/mime.types
.ds vU ~/.mime.types
.\"--MKMAN-END--
.\" --BEGINSTRIP--
.\"
.ds BO (Boolean)
.ds CM (Compose mode)
.ds ID [v15 behaviour may differ]
.ds IN [v15-compat]
.ds NQ [Only new quoting rules]
.ds OB [Obsolete]
.ds OP [Option]
.ds OU [no v15-compat]
.ds RO (Read-only)
.ds SM (Send mode)
.\"
.if !d str-Lb-libterminfo \
.ds str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo)
.
.Dt "\*(UU" 1
.Os
.Mx -enable
.
.
.Sh NAME
.Nm \*(UA \%[\*(VV]
.Nd send and receive Internet mail
.
.
.\" .Sh SYNOPSIS {{{
.Sh SYNOPSIS
.
.\" Keep in SYNC: ./nail.1:"SYNOPSIS, main()
.Nm \*(uA
.Bk -words
.Op Fl DdEFinv~#
.Op Fl \&: Ar spec
.Op Fl A Ar account
.Op : Ns Fl a Ar attachment Ns \&:
.Op : Ns Fl b Ar bcc-addr Ns \&:
.Op : Ns Fl C Ar """field:\0body""" Ns \&:
.Op : Ns Fl c Ar cc-addr Ns \&:
.Op Fl M Ar type | Fl m Ar file | Fl q Ar file | Fl t
.Op Fl r Ar from-addr
.Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
.Op Fl s Ar subject
.Op : Ns Fl T Ar """field:\0addr""" Ns \&:
.Op : Ns Fl X Ar cmd Ns \&:
.Op : Ns Fl Y Ar cmd Ns \&:
.Op Fl \&.
.Pf : Ar to-addr Ns \&:
.Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
.Ek
.Pp
.Nm \*(uA
.Bk -words
.Op Fl DdEeHiNnRv~#
.Op Fl \&: Ar spec
.Op Fl A Ar account
.Op : Ns Fl C Ar """field:\0body""" Ns \&:
.Op Fl L Ar spec
.Op Fl r Ar from-addr
.Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
.Op Fl u Ar user
.Op : Ns Fl X Ar cmd Ns \&:
.Op : Ns Fl Y Ar cmd Ns \&:
.Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
.Ek
.Nm \*(uA
.Bk -words
.Op Fl DdEeHiNnRv~#
.Op Fl \&: Ar spec
.Op Fl A Ar account
.Op : Ns Fl C Ar """field:\0body""" Ns \&:
.Fl f
.Op Fl L Ar spec
.Op Fl r Ar from-addr
.Oo : Ns Fl S\0 Ns Ar var Ns Oo Ns = Ns Ar value Ns Oc Ns : Ns Oc
.Op : Ns Fl X Ar cmd Ns \&:
.Op : Ns Fl Y Ar cmd Ns \&:
.Op Ar file
.Op Fl Fl \~ Ns : Ns Ar mta-option Ns \&:
.Ek
.Pp
.Nm \*(uA
.Fl h | Fl Fl help
.Nm \*(uA
.Fl V | Fl Fl version
.
.\" }}}
.
.
.Mx -toc -tree html pdf ps xhtml
.
.
.\" .Sh DESCRIPTION {{{
.Sh DESCRIPTION
.
.Bd -filled -compact -offset indent
.Sy Note:
S-nail (\*(UA) will see major changes in v15.0 (circa 2022).
Some backward incompatibilities cannot be avoided.
.Sx COMMANDS
change to
.Sx "Shell-style argument quoting" ,
and shell metacharacters will become (more) meaningful.
Some commands accept new syntax today via
.Cm wysh
.Pf ( Sx "Command modifiers" ) .
Behaviour is flagged \*(IN and \*(OU,
.Ic set Ns
ting
.Va v15-compat
.Pf ( Sx "INTERNAL VARIABLES" )
will choose new behaviour when applicable;
giving it a value makes
.Cm wysh
an implied default.
\*(OB flags what will vanish.
.Pp
.Sy Warning!
.Va v15-compat
(with value) will be a default in v14.10.0!
.Ed
.
.Pp
\*(UA provides a simple and friendly environment for sending and
receiving mail.
It is intended to provide the functionality of the POSIX
.Xr mailx 1
command, but is MIME capable and optionally offers extensions for
line editing, S/MIME, SMTP and POP3, among others.
\*(UA divides incoming mail into its constituent messages and allows
the user to deal with them in any order.
It offers many
.Sx COMMANDS
and
.Sx "INTERNAL VARIABLES"
for manipulating messages and sending mail.
It provides the user simple editing capabilities to ease the composition
of outgoing messages, and increasingly powerful and reliable
non-interactive scripting capabilities.
.
.\" .Ss "Options" {{{
.Ss "Options"
.
.Bl -tag -width ".It Fl BaNg"
.Mx
.It Fl \&: Ar spec , Fl Fl resource-files Ns =..
Controls loading of (as via
.Ic source )
.Sx "Resource files" :
.Ar spec
is parsed case-insensitively, the letter
.Ql s
corresponds to the system wide
.Pa \*(UR ,
.Ql u
the user's personal file
.Pa \*(ur .
The (original) system wide resource is also compiled-in, accessible via
.Ql x .
The letters
.Ql -
and
.Ql /
disable usage of resource files.
Order matters, default is
.Ql su .
This option overrides
.Fl n .
.
.Mx
.It Fl A Ar name , Fl Fl account Ns =..
Activate user
.Ic account
.Ar name
after program startup is complete (resource files loaded, only
.Fl X
commands are to be executed), and switch to its
.Mx -sx
.Sx "primary system mailbox"
(most likely the
.Va inbox ) .
If activation fails the program
.Pf e Ic xit Ns
s if used non-interactively, or if any of
.Va errexit
or
.Va posix
are set.
.
.Mx
.It Fl a Ar file Ns Oo Ar =input-charset Ns Oo Ar #output-charset Oc Oc , \
Fl Fl attach Ns =..
\*(SM Attach
.Ar file .
For \*(CM opportunities refer to
.Ic ~@
and
.Ic ~^ .
.Ar file
is subject to tilde expansion (see
.Sx "Filename transformations"
and
.Ic folder ) ;
if it is not accessible but contains a
.Ql =
character, anything before the last
.Ql =
will be used as the filename, anything thereafter as a character set
specification, as shown.
.Pp
If only an input character set
.Mx -ix "character set specification"
is specified, the input side is fixed, and no character set conversion
will be applied; an empty or the special string hyphen-minus
.Ql -
is taken for
.Va ttycharset
(the default).
If an output character set has also been specified the desired
conversion is performed immediately, not considering file type and
content, except for an empty string or hyphen-minus
.Ql - ,
which select the default conversion algorithm (see
.Sx "Character sets" ) :
no immediate conversion is performed,
.Ar file
and its contents will be MIME-classified
.Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files")
first \(em only the latter mode is available unless
.Va features
includes
.Ql ,+iconv, .
.
.It Fl B
(\*(OB: \*(UA will always use line-buffered output, to gain
line-buffered input even in batch mode enable batch mode via
.Fl # . )
.
.Mx
.It Fl b Ar addr , Fl Fl bcc Ns =..
\*(SM Send a blind carbon copy to recipient
.Ar addr .
The option may be used multiple times.
Also see the section
.Sx "On sending mail, and non-interactive mode" .
.
.Mx
.It Fl C Ar """field: body""" , Fl Fl custom-header Ns =..
Create a custom header which persists for an entire session.
A custom header consists of the field name followed by a colon
.Ql \&:
and the field content body, for example
.Ql -C """Blah: Neminem laede; imo omnes, quantum potes, juva""" .
Standard header field names cannot be overwritten by custom headers.
Runtime adjustable custom headers are available via the variable
.Va customhdr ,
and in \*(CM
.Ic ~^ ,
one of the
.Sx "COMMAND ESCAPES" ,
as well as
.Ic digmsg
are the most flexible and powerful options to manage message headers.
This option may be used multiple times.
.
.Mx
.It Fl c Ar addr , Fl Fl cc Ns =..
\*(SM Just like
.Fl b ,
except it places the argument in the list of carbon copies.
.
.Mx
.It Fl D , Fl Fl disconnected
\*(OP Startup with
.Va disconnected
.Ic set .
.
.Mx
.It Fl d , Fl Fl debug
Enter a debug-only sandbox mode by setting the internal variable
.Va debug ;
the same can be achieved via
.Ql Fl S Va \&\&debug
or
.Ql Ic set Va \&\&debug .
Also see
.Fl v .
.
.Mx
.It Fl E , Fl Fl discard-empty-messages
\*(SM
.Ic set
.Va skipemptybody
and thus discard messages with an empty message part body, successfully.
.
.Mx
.It Fl e , Fl Fl check-and-exit
Just check if mail is present (in the system
.Va inbox
or the one specified via
.Fl f ) :
if yes, return an exit status of zero, a non-zero value otherwise.
To restrict the set of mails to consider in this evaluation a message
specification can be added with the option
.Fl L .
Quickrun: does not open an interactive session.
.
.Mx
.It Fl F
\*(SM Save the message to send in a file named after the local part of
the first recipient's address (instead of in
.Va record Ns ).
.
.Mx
.It Fl f , Fl Fl file
Read in the contents of the user's
.Mx -sx
.Sx "secondary mailbox"
.Ev MBOX
(or the specified file) for processing;
when \*(UA is quit, it writes undeleted messages back to this file
(but be aware of the
.Va hold
option).
The optional
.Ar file
argument will undergo some special
.Sx "Filename transformations"
(as via
.Ic folder ) .
Note that
.Ar file
is not an argument to the flag
.Fl \&\&f ,
but is instead taken from the command line after option processing has
been completed.
In order to use a
.Ar file
that starts with a hyphen-minus, prefix with a relative path, as in
.Ql ./-hyphenbox.mbox .
.
.Mx
.It Fl H , Fl Fl header-summary
Display a summary of
.Ic headers
for the given
.Ic folder
(depending on
.Fl u ,
.Va inbox
or
.Ev MAIL ,
or as specified via
.Fl f ) ,
then exit.
A configurable summary view is available via the option
.Fl L .
This mode does not honour
.Va showlast .
Quickrun: does not open an interactive session.
.
.Mx
.It Fl h , Fl Fl help
Show a brief usage summary; use
.Fl Fl long-help
for a list long options.
.
.Mx
.It Fl i
.Ic set
.Va ignore
to ignore tty interrupt signals.
.
.Mx
.It Fl L Ar spec , Fl Fl search Ns =..
Display a summary of
.Ic headers
of all messages that match the given
.Ar spec
in the
.Ic folder
found by the same algorithm used by
.Fl H ,
then exit.
See the section
.Sx "Specifying messages"
for the format of
.Ar spec .
This mode does not honour
.Va showlast .
.Pp
If the
.Fl e
option has been given in addition no header summary is produced,
but \*(UA will instead indicate via its exit status whether
.Ar spec
matched any messages
.Pf ( Ql 0 )
or not
.Pf ( Ql 1 ) ;
note that any verbose output is suppressed in this mode and must instead
be enabled explicitly (see
.Fl v ) .
Quickrun: does not open an interactive session.
.
.Mx
.It Fl M Ar type
\*(SM Will flag standard input with the MIME
.Ql Content-Type:
set to the given known
.Ar type
.Pf ( Sx "HTML mail and MIME attachments" , "The mime.types files" )
and use it as the main message body.
\*(ID Using this option will bypass processing of
.Va message-inject-head
and
.Va message-inject-tail .
Also see
.Fl q , m , t .
.
.Mx
.It Fl m Ar file
\*(SM MIME classify the specified
.Ar file
and use it as the main message body.
\*(ID Using this option will bypass processing of
.Va message-inject-head
and
.Va message-inject-tail .
Also see
.Fl q , M , t .
.
.Mx
.It Fl N , Fl Fl no-header-summary
inhibit the initial display of message headers when reading mail or
editing a mailbox
.Ic folder
by calling
.Ic unset
for the internal variable
.Va header .
.
.Mx
.It Fl n
Standard flag that inhibits reading the system wide
.Pa \*(UR
upon startup.
The option
.Fl \&:
allows more control over the startup sequence; also see
.Sx "Resource files" .
.
.Mx
.It Fl q Ar file , Fl Fl quote-file Ns =..
\*(SM Initialize the message body with the contents of
.Ar file ,
which may be standard input
.Ql -
only in non-interactive context.
Also see
.Fl M , m , t .
.
.Mx
.It Fl R , Fl Fl read-only
Any mailbox
.Ic folder
aka\&
.Ic folder
opened will be in read-only mode.
.
.
.Mx
.It Fl r Ar from-addr , Fl Fl from-address Ns =..
The RFC 5321 reverse-path used for relaying and delegating messages to
its destination(s), for example to report delivery errors, is normally
derived from the address which appears in the
.Va from
header (or, if that contains multiple addresses, in
.Va sender ) .
A file-based aka local executable
.Va mta
(Mail-Transfer-Agent), however, instead uses the local identity of the
initiating user.
.
.Pp
When this command line option is used the given single addressee
.Ar from-addr
will be assigned to the internal variable
.Va from ,
but in addition the command line option
.Fl \&\&f Ar from-addr
will be passed to a file-based
.Va mta
whenever a message is sent.
Shall
.Ar from-addr
include a user name the address components will be separated and
the name part will be passed to a file-based
.Va mta
individually via
.Fl \&\&F Ar name .
Even though not a recipient the
.Ql shquote
.Va expandaddr
flag is supported.
.
.Pp
If an empty string is passed as
.Ar from-addr
then the content of the variable
.Va from
(or, if that contains multiple addresses,
.Va sender )
will be evaluated and used for this purpose whenever the file-based
.Va mta
is contacted.
By default, without
.Fl \&\&r
that is, neither
.Fl \&\&f
nor
.Fl \&\&F
command line options are used when contacting a file-based MTA, unless
this automatic deduction is enforced by
.Ic set Ns
ting the internal variable
.Va r-option-implicit .
.
.Pp
Remarks: many default installations and sites disallow overriding the
local user identity like this unless either the MTA has been configured
accordingly or the user is member of a group with special privileges.
Passing an invalid address will cause an error.
.
.
.Mx
.It Fl S Ar var Ns Oo = Ns value Oc , Fl Fl set Ns =..
.Ic set
(or, with a prefix string
.Ql no ,
as documented in
.Sx "INTERNAL VARIABLES" ,
.Ic unset )
.Ar var Ns
iable and optionally assign
.Ar value ,
if supported; \*(ID the entire expression is evaluated as if specified
within dollar-single-quotes (see
.Sx "Shell-style argument quoting" )
if the internal variable
.Va v15-compat
is set.
If the operation fails the program will exit if any of
.Va errexit
or
.Va posix
are set.
Settings established via
.Fl \&\&S
cannot be changed from within
.Sx "Resource files"
or an account switch initiated by
.Fl A .
They will become mutable again before commands registered via
.Fl X
are executed.
.
.Mx
.It Fl s Ar subject , Fl Fl subject Ns =..
\*(SM Specify the subject of the message to be sent.
Newline (NL) and carriage-return (CR) bytes are invalid and will be
normalized to space (SP) characters.
.
.Mx
.It Fl T Ar """field: addr""" , Fl Fl target Ns =..
\*(SM Add
.Ar addr
to the list of receivers targeted by
.Ar field ,
for now supported are only
.Ql bcc ,
.Ql cc ,
.Ql fcc ,
and
.Ql to .
Field and body (address) are separated by a colon
.Ql \&:
and optionally blank (space, tabulator) characters.
The
.Ql shquote
.Va expandaddr
flag is supported.
.Ar addr
is parsed like a message header address line, as if it would be part of
a template message fed in via
.Fl t ,
and the same modifier suffix is supported.
This option may be used multiple times.
.
.Mx
.It Fl t , Fl Fl template
\*(SM The text message given (on standard input) is expected to contain,
separated from the message body by an empty line, one or multiple
plain text message headers.
\*(ID Readily prepared MIME mail messages cannot be passed.
Headers can span multiple consecutive lines if follow lines start with
any amount of whitespace.
A line starting with the number sign
.Ql #
in the first column is ignored.
Message recipients can be given via the message headers
.Ql To: ,
.Ql Cc: ,
.Ql Bcc:
(the
.Ql ?single
modifier enforces treatment as a single addressee, for example
.Ql To?single: exa, <m@ple> )
or
.Ql Fcc: ,
they will be added to any recipients specified on the command line,
and are likewise subject to
.Va expandaddr
validity checks.
If a message subject is specified via
.Ql Subject:
then it will be used in favour of one given on the command line.
.Pp
More optional headers are
.Ql Reply-To:
(possibly overriding
.Va reply-to ) ,
.Ql Sender:
.Pf ( Va sender ) ,
.Ql From:
.Pf ( Va from
and / or option
.Fl r ) .
.Ql Message-ID: ,
.Ql In-Reply-To: ,
.Ql References:
and
.Ql Mail-Followup-To: ,
by default created automatically dependent on message context, will
be used if specified (a special address massage will however still occur
for the latter).
Any other custom header field (also see
.Fl C ,
.Va customhdr
and
.Ic ~^ )
is passed through entirely
unchanged, and in conjunction with the options
.Fl ~
or
.Fl #
it is possible to embed
.Sx "COMMAND ESCAPES" .
Also see
.Fl M , m , q .
.
.Mx
.It Fl u Ar user , Fl Fl inbox-of Ns =..
Initially read the
.Mx -sx
.Sx "primary system mailbox"
of
.Ar user ,
appropriate privileges presumed; effectively identical to
.Ql Fl \&\&f Ns \0%user .
.
.Mx
.It Fl V , Fl Fl version
Show \*(UAs
.Va version
and exit.
The command
.Ic version
will also show the list of
.Va features :
.Ql $ \*(uA -:/ -Xversion -Xx .
.
.Mx
.It Fl v , Fl Fl verbose
.Ic set Ns
s the internal variable
.Va verbose
to enable logging of informational context messages.
(Increases level of verbosity when used multiple times.)
Also see
.Fl d .
.
.Mx
.It Fl X Ar cmd , Fl Fl startup-cmd Ns =..
Add the given (or multiple for a multiline argument)
.Ar cmd
to a list of commands to be executed before normal operation starts.
The commands will be evaluated as a unit, just as via
.Ic source .
Correlates with
.Fl #
and
.Va errexit .
.
.Mx
.It Fl Y Ar cmd , Fl Fl cmd Ns =..
Add the given (or multiple for a multiline argument)
.Ar cmd
to a list of commands to be executed after normal operation has started.
The commands will be evaluated successively in the given order, and as
if given on the program's standard input \(em before interactive
prompting begins in interactive mode, after standard input has been
consumed otherwise.
.
.Mx
.It Fl ~ , Fl Fl enable-cmd-escapes
Enable
.Sx "COMMAND ESCAPES"
in \*(CM even in non-interactive use cases.
This can for example be used to automatically format the composed
message text before sending the message:
.Bd -literal -offset indent
$ ( echo 'line one. Word. Word2.';\e
echo '~| /usr/bin/fmt -tuw66' ) |\e
LC_ALL=C \*(uA -d~:/ -Sttycharset=utf-8 [email protected]
.Ed
.
.Mx
.It Fl # , Fl Fl batch-mode
Enables batch mode: standard input is made line buffered, the complete
set of (interactive) commands is available, processing of
.Sx "COMMAND ESCAPES"
is enabled in
.Sx "Compose mode" ,
and diverse
.Sx "INTERNAL VARIABLES"
are adjusted for batch necessities, exactly as if done via
.Fl S :
.Va emptystart ,
.Pf no Va errexit ,
.Pf no Va header ,
.Pf no Va posix ,
.Va quiet ,
.Va sendwait ,
.Va typescript-mode
as well as
.Ev MAIL ,
.Ev MBOX
and
.Va inbox
(the latter three to
.Pa /dev/null ) .
Also, the values of
.Ev COLUMNS
and
.Ev LINES
are looked up, and acted upon.
The following prepares an email message in a batched dry run:
.Bd -literal -offset indent
$ for name in bob [email protected] [email protected]; do
printf 'mail %s\en~s ubject\enText\en~.\en' "${name}"
done |
LC_ALL=C \*(uA -#:x -Smta=test \e
-X'alias bob [email protected]'
.Ed
.
.Mx
.It Fl \&. , Fl Fl end-options
This flag forces termination of option processing in order to prevent
.Dq option injection
(attacks).
It also forcefully puts \*(UA into send mode, see
.Sx "On sending mail, and non-interactive mode" .
.El
.
.Pp
If the setting of
.Va expandargv
allows their recognition all
.Ar mta-option
arguments given at the end of the command line after a
.Ql --
separator will be passed through to a file-based
.Va mta
(Mail-Transfer-Agent) and persist for the entire session.
.Va expandargv
constraints do not apply to the content of
.Va mta-arguments .
Command line receiver address handling supports the
.Ql shquote
constraint of
.Va expandaddr ,
for more please see
.Sx "On sending mail, and non-interactive mode" .
.
.Bd -literal -offset indent
$ \*(uA -#:/ -X 'addrcodec enc Hey, ho <silver@go>' -Xx
.Ed
.\" }}}
.
.\" .Ss "A starter" {{{ review
.Ss "A starter"
.
\*(UA is a direct descendant of
.Bx
Mail, itself a successor to the Research
.Ux
mail which
.Dq was there from the start
according to
.Sx HISTORY .
It thus represents the user side of the
.Ux
mail system, whereas the system side (Mail-Transfer-Agent, MTA) was
traditionally taken by
.Xr sendmail 8
(and most MTAs provide a binary of this name for compatibility reasons).
If the \*(OPal SMTP
.Va mta
is included in the
.Va features
of \*(UA then the system side is not a mandatory precondition for mail
delivery.
.
.Pp
\*(UA strives for compliance with the POSIX
.Xr mailx 1
standard, but
.Va posix ,
one of the
.Sx "INTERNAL VARIABLES" ,
or its
.Sx ENVIRONMENT Ns
al equivalent
.Ev POSIXLY_CORRECT ,
needs to be set to adjust behaviour to be almost on par.
Almost, because there is one important difference: POSIX
.Sx "Shell-style argument quoting"
is (\*(ID increasingly) used instead of the
.Sx "Old-style argument quoting"
that the standard documents, which is believed to be a feature.
The builtin as well as the (default) global
.Pa \*(UR
.Sx "Resource files"
already bend the standard imposed settings a bit.
.
.Pp
For example,
.Va hold
and
.Va keepsave
are
.Ic set
in order to suppress the automatic moving of messages to the
.Mx -sx
.Sx "secondary mailbox"
.Ev MBOX
that would otherwise occur (see
.Sx "Message states" ) ,
and
.Va keep
to not remove empty system MBOX mailbox files (or all empty such files in
.Va posix
mode) to avoid mangling of file permissions when files eventually get
recreated.
.
.Pp
To enter interactive mode even if the initial mailbox is empty
.Va emptystart
is set,
.Va editheaders
to allow editing of headers as well as
.Va fullnames
to not strip down addresses in
.Sx "Compose mode" ,
and
.Va quote
to include the message that is being responded to when
.Ic reply Ns
ing, which is indented by an
.Va indentprefix
that also deviates from standard imposed settings.
.Va mime-counter-evidence
is fully enabled, too.
It sets
.Va followup-to-honour
and
.Va reply-to-honour
to comply with reply address desires.
.
.Pp
Credentials and other settings are easily addressable by grouping them via
.Ic account .
The file mode creation mask can be managed with
.Va umask .
Files and shell pipe output can be
.Ic source Ns
d for
.Ic eval Ns
uation, also during startup from within the
.Sx "Resource files" .
Informational context can be available by
.Ic set Ns
ting
.Va verbose
or
.Va debug
(as via
.Fl v , d ) .
.\" }}}
.
.\" .Ss "On sending mail, and non-interactive mode" {{{
.Ss "On sending mail, and non-interactive mode"
.
To send a message to one or more people, using a local or built-in
.Va mta
(Mail-Transfer-Agent) transport to actually deliver the generated mail
message, \*(UA can be invoked with arguments which are the names of
people to whom the mail will be sent, and the command line options
.Fl b
and
.Fl c
can be used to add (blind) carbon copy receivers:
.
.Bd -literal -offset indent
# Via test MTA
$ echo Hello, world | \*(uA -:/ -Smta=test -s test $LOGNAME
# Via sendmail(1) MTA
$ </dev/null \*(uA -:x -s test $LOGNAME
# Debug dry-run mode:
$ </dev/null LC_ALL=C \*(uA -d -:/ \e
-Sttycharset=utf8 -Sfullnames \e
-b [email protected] -c [email protected] -. \e
'(Lovely) Bob <[email protected]>' [email protected]
# With SMTP (no real sending due to -d debug dry-run)
$ LC_ALL=C \*(uA -d -:/ -Sv15-compat -Sttycharset=utf8 \e
-S mta=smtps://[email protected]:465 -Ssmtp-auth=none \e
-S [email protected] \e
-a /etc/mail.rc --end-options \e
[email protected] < /tmp/letter.txt
.Ed
.
.Pp
Email addresses and plain user names are subject to
.Ic alternates
filtering, names only are first expanded through
.Ic alias
and
.Va mta-aliases .
An address in angle brackets consisting only of a valid local user
.Ql <name>
will be converted to a fully qualified address if either
.Va hostname
is not set, or set to a non-empty value; if set to the empty value the
conversion is left up to the
.Va mta .
.\" When changing any of the following adjust any RECIPIENTADDRSPEC;
.\" grep the latter for the complete picture
By setting
.Va expandaddr
fine-grained control of recipient address types other than user names
and network addresses is possible.