File: email.texinfo

package info (click to toggle)
linuxcookbook 1.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,816 kB
  • ctags: 1
  • sloc: makefile: 40
file content (1103 lines) | stat: -rw-r--r-- 33,927 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
@c $Id: email.texinfo,v 1.18 2001/06/04 15:29:01 m Exp m $
@node Email, The Web, Communications, Networking
@comment  node-name,  next,  previous,  up
@chapter Email
@cindex email
@cindex electronic mail
@cindex mail, electronic
@cindex mail user agents
@cindex MUAs
@pindex mail
@pindex mailx

@noindent
The primary means of sending plain-text messages (or binaries in
attachment files) between users across computer networks and systems on
the Internet is called electronic mail, or @dfn{email} (and more often
than not these days, just ``mail'').

The number of email applications (called @dfn{mail user agents}, or
MUAs) available for Linux is large, and you could spend endless hours
exploring the details of all of them. Instead of guiding you toward this
route, this chapter attempts to do three things: give a brief intro to
using the default mail agent; give an overview of other well-supported
mail agents, with pointers on where to go for more info; and show how
you can use other tools on the system to manipulate your email.

The @code{mail} tool is the default mail agent on Debian and most other
Linux systems. It comes without many bells and whistles that are
standard with most MUAs, and any user who sends and receives email 
more than occasionally will certainly want to learn a more advanced
system (@pxref{Mail Agents, , Picking the Right Mail Application}).

However, @code{mail} is available on almost all Unix-based systems, and
it works in a pinch---by learning to use it you can always send and
receive email on any Linux- or Unix-based system you encounter.

@sp .25
@noindent
@strong{NOTE:} On some Unix-based systems, the name of the tool is
@code{mailx} instead of @code{mail}.


@menu
* Sending Mail::                Sending email.
* Receiving Mail::              Receiving email.
* Managing Mail::               Managing your email.
* Mail Attachments::            Dealing with mail attachments.
* Signature Files::             Signatures in email.
* Mail Agents::                 Different mail applications to try.
@end menu

@node Sending Mail, Receiving Mail, Email, Email
@comment  node-name,  next,  previous,  up
@section Sending Mail
@cindex sending mail
@cindex mail, sending
@cindex carbon copies, sending in mail
@pindex mail

@noindent
To send an email message with @code{mail}, give the email addresses to
which you are sending as arguments, and then type the message proper in
the lines that follow; type @kbd{C-d} on a line by itself to signify the
end of the message body, and to send the message.

@itemize @bullet
@item
To send an email message to @code{lisa@@example.com}, type:

@example
$ @kbd{mail lisa@@example.com @key{RET}
Subject: @kbd{Hello @key{RET}}
Hi there, long time no talk! I'm just learning how to use @key{RET} 
Linux and thought I'd show you how easy it is to send email! @key{RET}
C-d}
Cc: @kbd{@key{RET}}
@end example
@end itemize

The text you type on the @samp{Subject:} line is displayed as the
subject of your email message, and the lines of text you type after that
is the body text of the message. Type @kbd{C-d} on a line alone to end
the message. Then, @code{mail} prompts for @samp{Cc:} addresses; a
``carbon copy'' of the email message is sent to any addresses you give
here, if any (just type @kbd{@key{RET}} for none, and separate multiple
addresses with commas). 

When you type, @code{mail} just reads the standard input like any other
command-line tool, so there's little direct editing capability in this
basic email service---use @kbd{C-u} to erase the current line, and
@kbd{C-c C-c} (that is, @kbd{C-c} pressed twice) to cancel your input
and abort the message altogether.

That's it! No bells, no whistles---but no time-wasting excess, either.

@menu
* System Mail::                 Sending mail to a user on your system.
* File Mail::                   Emailing a file.
* URL Mail::                    Emailing the contents of a URL.
* Mail Keys::                   Special mail composition keystrokes. 
@end menu


@node System Mail, File Mail, Sending Mail, Sending Mail
@comment  node-name,  next,  previous,  up
@subsection Mailing a User on the Same System
@cindex mailing a user on the same system
@cindex sending mail to a user on the same system
@pindex mail

@noindent
To send an email message to another user on the same system, give their
username on the system instead of an email address (technically, you
@emph{are} giving the email address, since email addresses take the form
of @var{username}@@@var{hostname}; when @var{hostname} is omitted, the
localhost is assumed).

@itemize @bullet
@item
To send an email message to user @code{mrs} on your local system, type:

@example
@cartouche
$ @kbd{mail mrs @key{RET}}
Subject: @kbd{are you going to the party tonight? @key{RET}
C-d}
Cc: @kbd{@key{RET}}
Null message body; hope that's ok
$
@end cartouche
@end example
@end itemize

This command sends an email message to the user @code{mrs} on the local
system. The email message itself is empty, but the subject is a short
note asking whether user @code{mrs} will be attending a party.

@sp .25
@noindent
@strong{NOTE:} Besides being good for sending mail to users that you
might share your system with, @code{mail} is useful for sending
@emph{yourself} mail, as a way to give yourself a reminder at your
terminal (@pxref{Self Emails, , Sending Yourself Email Reminders}).


@node File Mail, URL Mail, System Mail, Sending Mail
@comment  node-name,  next,  previous,  up
@subsection Mailing a File or the Output of a Command
@cindex mailing files or the output of commands
@cindex file, mailing a
@cindex command, mailing the output of a
@pindex mail

@noindent
The @code{mail} tool is also useful for mailing the contents of a text
file or the text output of a command. To do this, give the email
addresses you want to send to as arguments to @code{mail}, and use the
standard input redirection operators to redirect the text to use as the
message body (@pxref{Redirection, , Redirecting Input and Output}).

@itemize @bullet
@item
To mail the contents of the text file @file{trades} to the email address
@code{terrapin@@example.com}, type:

@example
$ @kbd{mail terrapin@@example.com < trades @key{RET}}
@end example
@end itemize


@node URL Mail, Mail Keys, File Mail, Sending Mail
@comment  node-name,  next,  previous,  up
@subsection Mailing the Contents of a URL
@cindex mailing the contents of a URL
@cindex URL, mailing the contents of a 
@pindex mail
@pindex lynx

@noindent
A variation on the previous recipe is to use @code{mail} and shell
redirection to send the output of some command to some address via
email. You can, for example, send the contents of a URL as an annotated
text file by redirecting the output of the @code{lynx} Web browser
(@pxref{Web Text, , Reading Text from the Web}).

@itemize @bullet
@item
To mail the text of the URL @url{http://etext.org/} as annotated text to
the email address @code{droneon@@example.com}, type:

@example
$ @kbd{mail droneon@@example.com < lynx -dump -number_links
http://etext.org/ @key{RET}} 
@end example
@end itemize


@node Mail Keys, , URL Mail, Sending Mail
@comment  node-name,  next,  previous,  up
@subsection Special Mail Composition Keystrokes
@cindex special mail composition keystrokes
@cindex mail, special composition keystrokes
@cindex tilde commands, in mail
@pindex mail

@noindent
The following table lists the special keystrokes that work when
composing a @code{mail} message, and describes their functions.

@multitable @columnfractions .30 .70
@item @sc{Keystroke}
@tab @sc{Description}
@item @code{C-c C-c}
@tab Abort the current message and exit @code{mail}.

@item @code{. @key{RET}} @var{or} @code{C-d}
@tab On a blank line, either of these commands sends the message and
then exits @code{mail}.

@item @code{C-u}
@tab Erase the current line and move the cursor to the beginning of the
line.
@end multitable

There are also a few special commands that you may use while composing
the body of the message. They're known as ``tilde escapes'' because you
specify them by typing a tilde character (@samp{~}).

The following table lists some of these commands and describes their
functions.

@multitable @columnfractions .30 .70
@item @sc{Command}
@tab @sc{Description}
@item @code{~!@var{command}}
@tab Run @var{command} in a shell.

@item @code{~b@var{address}}
@tab Send a blind carbon copy to the usernames or email addresses
given.

@item @code{~d}
@tab Copy the file @file{dead.letter} from your home directory into the
message.

@item @code{~e}
@tab Edit the message in the default text editor program. (When you exit
the text editor, you are returned to @code{mail}.)

@item @code{~f@var{number}}
@tab Insert copies of the specified received messages into the message
body. Messages are specified by number or a range (for example,
@samp{2-4} inserts messages two through four inclusive); if no number is
given, the current received message is inserted.

@item @code{~F}
@tab Same as @samp{~f}, but reads in the messages with full headers.

@item @code{~r@var{file}}
@tab Insert a copy of the file @var{file} into the message.

@item @code{~w@var{file}}
@tab Write a copy of the body text into the file @var{file}.
@end multitable

These commands should each be typed on a line by itself.

@itemize @bullet
@item
To insert a copy of the current mail message into the body of the
message you are writing, and then open the message in the default
text editor, type:

@example
@kbd{~f @key{RET}}
@kbd{~e @key{RET}}
@end example
@end itemize


@node Receiving Mail, Managing Mail, Sending Mail, Email
@comment  node-name,  next,  previous,  up
@section Receiving Mail
@cindex receiving mail
@cindex mail, receiving
@cindex INBOX 
@cindex $MAIL
@pindex mail
@pindex echo

@noindent
On Linux-based systems, the @dfn{INBOX} is a text file on the system
where your incoming mail is written to. Its location is always given by
@code{$MAIL}, a special shell variable (@pxref{Shell Prompt, , Changing
the Shell Prompt}).

@itemize @bullet
@item
To output the location of your INBOX, type:

@example
$ @kbd{echo $MAIL @key{RET}}
@end example
@end itemize

Usually, the INBOX location is in the @file{/var/spool/mail} directory,
and has the same name as your username---so if your username is
@code{mrs}, your INBOX is likely @file{/var/spool/mail/mrs}.

You shouldn't directly edit this file, because doing so can
inadvertently cause you to lose incoming mail.

To see if you have any mail waiting in your INBOX, type @kbd{mail}. If
you don't have any mail, @code{mail} will indicate this and exit; if you
@emph{do} have mail waiting, @code{mail} outputs a list of message
headers, one line per message, each containing the status of the message
(@samp{N} for new messages, blank for previously read messages), the
message number, the name of the sender, the date and time the message
was received, and the number of lines and characters in the message.

@itemize @bullet
@item
To see if you have mail, type:
@end itemize
@example
@cartouche
$ @kbd{mail @key{RET}}
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/m": 3 messages 3 new
>N  1 mrs           Mon Sep 6 17:29  13/345 "Re: A modest proposal"
 N  2 Ray           Tue Sep 7 04:20  15/694 "Latest news"
 N  3 lisa@@example  Tue Sep 7 09:35  19/869 "Re: Hello"
& 
@end cartouche
@end example

In this example, the user has three messages waiting---one from
@email{mrs}, one from @email{Ray}, and one from @code{lisa@@example.com}.

The @code{mail} prompt is an ampersand (@samp{&}) character; from there,
you can read, delete, reply to, and save messages.

When you type @key{RET} at the @samp{&} prompt, @code{mail} outputs the
next unread message to the screen. You can also type a number to output
that message.

@itemize @bullet
@item
To read the next unread message in @code{mail}, type:

@example
& @kbd{@key{RET}}
@end example

@item
To read message number three in @code{mail}, type:

@example
& @kbd{3 @key{RET}}
@end example
@end itemize

There are two ways to exit @code{mail}: type @kbd{q} to exit @code{mail}
and apply the deletion commands you have given, if any, to your INBOX;
type @kbd{x} to exit @code{mail} and revert the state of your INBOX to
how it was before you ran @code{mail}. 

@itemize @bullet
@item
To exit @code{mail} and revert your INBOX to its state before you
started @code{mail}, type:

@example
& @kbd{x @key{RET}}
@end example
@end itemize

@menu
* Deleting Mail::               Deleting email.
* Reading Mail Options::        Command options while reading mail.
@end menu


@node Deleting Mail, Reading Mail Options, Receiving Mail, Receiving Mail
@comment  node-name,  next,  previous,  up
@subsection Deleting Mail
@cindex deleting mail
@cindex mail, deleting
@pindex mail

@noindent
To delete a message in @code{mail}, type @kbd{d} at the @samp{&} prompt
after reading the message in question. You can also specify a message or
a range of messages to delete as an option to @kbd{d}.

@itemize @bullet
@item
To delete the message you just read, type:

@example
& @kbd{d @key{RET}}
@end example

@item
To delete message 3, type:

@example
& @kbd{d3 @key{RET}}
@end example

@item
To delete messages 10 through 14, type:

@example
& @kbd{d10-14 @key{RET}}
@end example
@end itemize


@node Reading Mail Options, , Deleting Mail, Receiving Mail
@comment  node-name,  next,  previous,  up
@subsection Options Available while Reading Mail
@cindex options available while reading mail
@cindex reading mail, options available while 
@cindex mail, options available while reading
@pindex mail

@noindent
The following table summarizes the most common @code{mail} commands for
reading mail; these commands work at the @samp{&} prompt.

@multitable @columnfractions .30 .70
@item @sc{Command}
@tab @sc{Description}
@item @code{?}
@tab Output a help menu containing a list of mail options and their
meanings.

@item @code{d}
@tab Delete a message. Give the number or range of the message(s) to
delete as an argument.

@item @code{h}
@tab Output a list of headers of mail messages. You can specify a range
or the number of the message to start with.

@item @code{q}
@tab Exit @code{mail} and apply the changes you have made in this
@code{mail} session to your INBOX.

@item @code{r}
@tab Reply to the message you last read; you can also give a message
number as an argument to reply to that message number.

@item @code{u}
@tab Undelete a message you have deleted in the current mail
session. Give the number or range of the message(s) to be undeleted as
an argument.

@item @code{x}
@tab Exit @code{mail} and revert the INBOX to its state before this
@code{mail} session.

@item @code{s @var{file}}
@tab Save the message you last read to the file in your home directory
specified by @var{file} (if the file does not exist, @code{mail} will
ask you whether or not it should @w{create it).}
@end multitable

@sp .25
@noindent
@strong{NOTE:} By default, only you (and, as always, the superuser) have
access to read your INBOX. While there are tools available (such as
@code{mail}, and the other MUAs) to read this file in special ways, you
can also view this file like any other text file (@pxref{Viewing Text, ,
Viewing Text}).


@node Managing Mail, Mail Attachments, Receiving Mail, Email
@comment  node-name,  next,  previous,  up
@section Managing Mail
@cindex managing mail
@cindex mail, managing
@cindex mail folder

@noindent
A @dfn{mail folder} is simply a text file whose contents consist of
saved mail messages; any tool that works on text can be used on a mail
folder.

The following subsections describe some of the common ways to manage and
otherwise modify your saved mail.

@menu
* Viewing Folders::             Viewing a folder of email.
* Biff::                        Announcing when the mailman has arrived.
* Counting Mail::               Counting the mail you have.
* Determining Sender::          Finding out who your mail is from.
* Verifying Addresses::         Finding out if an email address is correct.
@end menu


@node Viewing Folders, Biff, Managing Mail, Managing Mail
@comment  node-name,  next,  previous,  up
@subsection Viewing a Mail Folder
@cindex viewing a mail folder
@cindex mail folder, viewing a
@pindex elm
@pindex less
@pindex mail

@flushleft
@sf{Debian}: @file{elm-me+}
@sf{WWW}: @url{http://www.instinct.org/elm/}
@end flushleft
@*
@noindent
You can view your mail folders in @code{less} or edit them in a text
editor, although the folder will appear as one long scroll containing
all of the messages the folder contains.

You can also view them in @code{elm} (@pxref{Mail Agents, , Picking the
Right Mail Application}) or open them with @code{mail}, and they will
appear in the normal way as your INBOX would appear with these tools.

To view a mail folder with @code{elm}, give the name of the folder as
an argument to the @samp{-f} option.

@itemize @bullet
@item
To view the mail folder @file{~/email/mrs} in @code{elm}, type:

@example
$ @kbd{elm -f ~/email/mrs @key{RET}}
@end example
@end itemize

If you save your mail messages in a lot of separate folders, you can
view a sorted list of all messages from all files by using @code{cat} in
conjunction with @code{elm}. Concatenate all the folders into one with
@code{cat} and then view that file in @code{elm} as you would view any
folder.

@itemize @bullet
@item
To view the contents of all of the email folders in your @file{~/email}
directory, type:

@example
$ @kbd{cat ~/email/* > allmessages @key{RET}}
$ @kbd{elm -f allmessages @key{RET}}
@end example
@end itemize

These commands write a new file, @file{allmessages}, in the current
directory, containing the contents of all email folders in
@file{~/email}; then, that file is viewed in @code{elm}.

@sp .25
@noindent
@strong{NOTE:} To view a list showing who all the messages in a folder
are from, use @code{frm}; see @ref{Determining Sender, , Seeing Who Your
Mail Is From}.


@node Biff, Counting Mail, Viewing Folders, Managing Mail
@comment  node-name,  next,  previous,  up
@subsection Setting Notification for New Mail
@cindex setting notification for new mail
@cindex mail notification, setting
@cindex notification for new mail, setting
@cindex Biff
@cindex Joy, Bill
@cindex Stettner, Heidi
@cindex Friedman, Noah
@cindex spam
@pindex biff
@pindex xbiff

@flushleft
@sf{Debian}: @file{biff}
@sf{WWW}: @url{ftp://ftp.uk.linux.org/pub/linux/Networking/}
@sf{WWW}: @url{http://www.splode.com/~friedman/software/packages/index.html}
@end flushleft
@*
@noindent
The @code{biff} tool notifies you when new mail arrives, by printing the
header and first few lines of a mail message.

To turn @code{biff} on, use @samp{y} as an option. To turn @code{biff}
off, so that you stop being notified when new mail arrives, use @samp{n}
as an option. @code{biff} options don't take a hyphen.

@itemize @bullet
@item
To turn @code{biff} on, type:

@example
$ @kbd{biff y @key{RET}}
@end example
@end itemize

Some people put the above line in their @file{.bashrc} file so that
@code{biff} is always set on in all of their shells (@pxref{Shell
Prompt, , Changing the Shell Prompt}).

Typing @code{biff} alone with no options will tell you whether
@code{biff} is set to @samp{y} or @samp{n}. 

@itemize @bullet
@item
To see what @code{biff} is set to, type:

@example
$ @kbd{biff @key{RET}}
@end example
@end itemize

A companion tool, @code{xbiff}, works only in the X Window System (you
can use the regular @code{biff} in X, too). When you start it,
@code{xbiff} draws a window containing a mailbox that looks like
this:@footnote{Noah Friedman has an alternate set of ``Spam'' images you
can use, available from
@url{http://www.splode.com/~friedman/software/packages/index.html}.}

@image{email-xbiff-01,}
@c comma fix for texi2html

When you have mail, @code{xbiff} rings the system bell, the window icon
reverses color, and the mailbox flag goes up:

@image{email-xbiff-02,}
@c comma fix for texi2html

@sp .25
@noindent
@strong{NOTE:} The original version of @code{biff} was named after a
dog. In the early 1980s at a UC Berkeley computer lab, a girl would
bring her dog, Biff, with her when she went to use the computers. Biff
was known for barking at the mailman when he came in to deliver the
day's mail. He was also very popular with all of the BSD UNIX hackers at
Berkeley, and when one of them wrote a mail notification tool, he
thought of Biff---hence the name. (Biff, the dog, died in August 1993.)


@node Counting Mail, Determining Sender, Biff, Managing Mail
@comment  node-name,  next,  previous,  up
@subsection Counting How Many Messages You Have
@cindex counting how many messages you have
@cindex messages, counting how many you have
@cindex mail, counting
@pindex messages

@flushleft
@sf{Debian}: @file{elm-me+}
@sf{WWW}: @url{ftp://ftp.uu.net/networking/mail/elm}
@end flushleft
@*
@noindent
Use @code{messages} to count the number of mail messages in a folder
or file. Give the name of a mail folder as an argument; with no
arguments, it counts the mail you have waiting in your INBOX.

@itemize @bullet
@item
To see how many email messages you have waiting, type:

@example
$ @kbd{messages @key{RET}}
@end example

@item
To count the number of email messages in the mail folder
@file{~/email/saved}, type:

@example
$ @kbd{messages ~/email/saved @key{RET}}
@end example
@end itemize


@node Determining Sender, Verifying Addresses, Counting Mail, Managing Mail
@comment  node-name,  next,  previous,  up
@subsection Seeing Who Your Mail Is From
@cindex seeing who your mail is from
@cindex mail, seeing who yours is from
@pindex frm
@pindex from

@flushleft
@sf{Debian}: @file{elm-me+}
@sf{WWW}: @url{ftp://ftp.uu.net/networking/mail/elm}
@end flushleft
@*
@noindent
Use @code{frm} to output a list of sender names and subjects for your
mail. Give the name of a mail folder as an option; with no options,
@code{frm} reads your INBOX.

@itemize @bullet
@item
To output a list showing sender names and subjects of your incoming
mail, type:

@example
$ @kbd{frm @key{RET}}
@end example

@item
To output a list showing sender names and subjects of the mail in the
file @file{~/email/saved}, type:

@example
$ @kbd{frm ~/email/saved @key{RET}}
@end example
@end itemize

@sp .25
@noindent
@strong{NOTE:} An alternate tool, @code{from}, works in similar fashion,
but it does not output subject lines; instead, it outputs the names of
senders and the time that messages were received.


@node Verifying Addresses, , Determining Sender, Managing Mail
@comment  node-name,  next,  previous,  up
@subsection Verifying an Email Address
@cindex verifying an email address
@cindex email addresses, verifying
@pindex vrfy

@flushleft
@sf{Debian}: @file{vrfy}
@sf{WWW}: @url{ftp://ftp.nikhef.nl/pub/network/}
@end flushleft
@*
@noindent
Use @code{vrfy} to determine whether or not a given email address
works. This is useful when you are unsure whether or not you have the
right email address for someone. If the address works, @code{vrfy}
outputs a message indicating that the recipient exists; if the address
is not valid, @code{vrfy} outputs a message saying that the user is
unknown.

@itemize @bullet
@item
To verify that the email address @code{user@@example.edu} is valid,
type:

@example
$ @kbd{vrfy user@@example.edu @key{RET}}
@end example
@end itemize

Use the @samp{-f} option to specify a text file containing email
addresses; @code{vrfy} attempts to verify all email addresses contained
in the file.

@itemize @bullet
@item
To verify all of the email addresses contained in the file
@file{net-legends-faq}, type:

@example
$ @kbd{vrfy -f net-legends-faq @key{RET}}
@end example
@end itemize

@sp .25
@noindent
@strong{NOTE:} @code{vrfy} relies on the remote system to get this
information; in these days of the heavily corporatized Internet, an
increasing number of sites no longer supply this kind of information to
the general public. However, it's still useful enough to be worth
mentioning.


@iftex
@*@*@*
@end iftex
@node Mail Attachments, Signature Files, Managing Mail, Email
@comment  node-name,  next,  previous,  up
@section Mail Attachments
@cindex mail attachments
@cindex attachments, mail
@cindex MIME

@flushleft
@sf{Debian}: @file{metamail}
@sf{WWW}: @url{http://bmrc.berkeley.edu/~trey/emacs/metamail.html}
@end flushleft
@*
@noindent
MIME (``Multipurpose Internet Mail Extensions'') is an Internet standard
for encoding and attaching files to mail messages. It's used when
sending image, audio, or other non-plain-text data via email.

Normally, you read and send MIME mail with your MUA. The following
recipes, which show ways to send and receive MIME mail on the command
line, are useful for when you just use the @code{mail} tool to read and
send occasional mail with an attachment, but the built-in methods for
manipulating MIME mail in any reasonable MUA will invariably be easier
and more convenient than the techniques described here (@pxref{Mail
Agents, , Picking the Right Mail Application}).

@menu
* Reading Attachments::         Reading mail attachments.
* Sending Attachments::         Sending mail attachments.
@end menu


@node Reading Attachments, Sending Attachments, Mail Attachments, Mail Attachments
@comment  node-name,  next,  previous,  up
@subsection Reading a Mail Attachment
@cindex reading a mail attachment
@cindex mail attachment, reading a
@pindex metamail

@noindent
To read a mail attachment, write the message to a file and then run
@code{metamail} with the file name as an argument. @code{metamail} lists
each attachment and prompts you about whether it should display the
attachment, write it to a file, or skip it.

@itemize @bullet
To read a mail attachment, type:

@example
@cartouche
$ @kbd{mail @key{RET}}
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/m": 1 messages 1 new
>N  1 Photo Dept.   Mon Feb 12 14:37  231/10980 "New Images"
& @kbd{w1 image.mail @key{RET}}
"image.mail" [New file]
& @kbd{x @key{RET}}
$ @kbd{metamail image.mail @key{RET}}
@end cartouche
@end example
@end itemize

In this example, the @code{mail} tool was used to open the INBOX and
write the message to a file called @file{image.mail}; then,
@code{metamail} was run with the file name as an argument.


@node Sending Attachments, , Reading Attachments, Mail Attachments
@comment  node-name,  next,  previous,  up
@subsection Sending a Mail Attachment
@cindex sending a mail attachment
@cindex mail attachment, sending a
@pindex metasend

@noindent
To send a file as an email attachment, use @code{metasend}. It prompts
for the values to use in the @samp{To:}, @samp{Subject:}, and @samp{CC:}
header fields, plus the following values for each MIME attachment: its
@samp{Content-type:} field, which describes the kind of data the
attachment contains; the file name; and the type of encoding to use, if
any (usually one is recommended).

@itemize @bullet
@item
To mail the JPEG file @file{dream.jpeg} in the current directory to the
address @code{dali@@example.org}, type: 
@end itemize

@example
@cartouche
$ @kbd{metasend @key{RET}}
To: @kbd{dali@@example.org @key{RET}}
Subject: @kbd{The image you requested @key{RET}}
CC: @kbd{@key{RET}}
Content-type: @kbd{image/jpeg @key{RET}}
Name of file containing image/gif data: @kbd{dream.jpeg @key{RET}}
Do you want to encode this data for sending through the mail?
  1 -- No, it is already in 7 bit ASCII
  2 -- Yes, encode in base64 (most efficient)
  3 -- Yes, encode in quoted-printable (less efficient, more readable)
  4 -- Yes, encode it using uuencode (not standard, being phased out)
@kbd{2 @key{RET}}
Do you want to include another file too (y/n) [n] ? @kbd{n @key{RET}}
Delivering mail, please wait...  Mail delivery apparently succeeded.
$
@end cartouche
@end example

The following table lists values to use in the MIME @samp{Content-type:}
field for various kinds of files.

@multitable @columnfractions .30 .70
@item @sc{Value}
@tab @sc{File Type}
@item @code{application/gzip}
@tab File compressed with @code{gzip}.

@item @code{application/zip}
@tab File compressed with @code{zip}.

@item @code{application/postscript}
@tab PostScript file.

@item @code{image/jpeg}
@tab JPEG image file.

@item @code{image/png}
@tab PNG image file.

@item @code{audio/basic}
@tab Audio file.

@item @code{audio/mpeg3}
@tab MP3 audio file.

@item @code{audio/wav}
@tab WAV audio file.
@end multitable


@node Signature Files, Mail Agents, Mail Attachments, Email
@comment  node-name,  next,  previous,  up
@section Making an Email Signature
@cindex making an email signature
@cindex email signature, making an
@cindex signature file
@pindex sigrot

@flushleft
@sf{Debian}: @file{sigrot}
@sf{WWW}: @url{ftp://metalab.unc.edu/pub/Linux/system/mail/misc/}
@end flushleft
@*
@noindent
A @dfn{signature file} (often called a ``dot sig,'' and written as
@file{.sig}) is a text file containing text that you want to appear at
the end of email messages and other online postings.

Sometimes, people put their name, email address, and a small quote, or a
piece of ASCII art (such as text written in a @code{figlet}
font---@pxref{Figlet, , Horizonal Text Fonts}); once the World Wide Web
became popular, many people started including the URL of their home page
in their @file{.sig}.

The use of signatures goes in and out of vogue with the years; you can
decide whether or not you want to use one, but whatever you do, be sure
to keep your @file{.sig} at most four lines in length---to use any more
is considered very bad form. A first line consisting only of @samp{-- }
is sometimes used; many applications recognize this text as the
beginning of a @file{.sig} when processing messages.

You create your signature file in a text editor, just like any other
text file. Name the file @file{.signature} or @file{.sig}, and keep it
in your home directory.

If you want to use more than one signature, use @code{sigrot} to
``rotate'' your various signatures---every time you run @code{sigrot},
it selects one of the signature files you keep in your @file{.sigrot}
directory and writes it to @file{.signature}. To change your
@file{.signature} every time you log in, you would run @code{sigrot} in
your @file{.bash_login} file (@pxref{Shell, , The Shell}).


@node Mail Agents, , Signature Files, Email
@comment  node-name,  next,  previous,  up
@section Picking the Right Mail Application
@cindex picking the right mail application
@cindex mail application, picking the right
@cindex Emacs
@cindex GNOME
@cindex XEmacs
@pindex balsa
@pindex elm
@pindex gnus
@pindex mew
@pindex mh-e
@pindex mozilla
@pindex mutt
@pindex nmh
@pindex vm
@pindex wl

@noindent
The following table lists some of the more popular MUAs that are
available for Linux, describing their special features, and listing
their Debian package name and URL (when available).

@multitable @columnfractions .30 .70
@item @sc{Application}
@tab @sc{Description}
@item @code{balsa}
@tab A graphical email client that works in X with GNOME installed; its
interface is inspired somewhat by the proprietary Eudora.

@noindent
{@sf{Debian}}: @file{balsa}

@noindent
{@sf{WWW}}: @url{http://www.balsa.net/}

@item @code{elm}
@tab A menu-driven MUA, @code{elm} was popular in the early 1990s among
experienced users---it has some interesting features, including ways to
send mails in batch mode to many addresses at once, and a tool to send
telephone messages as email messages. Interest in @code{elm} has waned
somewhat over the years, and most novices are advised to try @code{mutt}
instead.

@noindent
{@sf{Debian}}: @file{elm me+}

@noindent
{@sf{WWW}}: @url{http://www.instinct.org/elm/}

@item @code{gnus}
@tab The @code{gnus} newsreader for Emacs@footnote{It comes
pre-installed with XEmacs.} can also be used to read and send mail. It
has many features and should appeal to Emacs lovers---but a warning: it
can be daunting to learn!

@noindent
{@sf{Debian}}: @file{gnus}

@noindent
{@sf{WWW}}: @url{http://www.gnus.org/}

@item @code{mew}
@tab @code{mew} is an Emacs mail and news facility developed in
Japan. It shows promise as a fairly new MUA and has many features for
handling mail in complex ways.

@noindent
{@sf{Debian}}: @file{mew}

@noindent
{@sf{WWW}}: @url{http://www.mew.org/}

@item @code{mh-e}
@tab MH-E is an Emacs front end to @code{nmh}, below. It's very
powerful, yet it remains easy to use. 

@noindent
{@sf{Debian}}: @file{emacsen-common}

@noindent
{@sf{WWW}}: @url{http://www.emacs.org/}

@item @code{mozilla}
@tab Netscape Inc.'s open source Web browser, @code{mozilla}, has its
familiar and self-explanatory email interface that works in the X Window
System.

@noindent
{@sf{Debian}}: @file{mozilla}

@noindent
{@sf{WWW}}: @url{http://www.mozilla.org/}

@item @code{mutt}
@tab The MUA currently in favor among many @code{vi} users is
@code{mutt}; it is one of the most popular MUAs for Linux.

@noindent
{@sf{Debian}}: @file{mutt}

@noindent
{@sf{WWW}}: @url{http://www.mutt.org/}

@item @code{nmh}
@tab The Rand ``Mail Handling'' system, @code{mh}, is not one
application but a collection of small tools for manipulating mail
folders. It should appeal to those who excel at building complex
commands from combinations of simple tools and operators. @code{nmh} is
the @emph{new} ``Mail Handling'' system, containing rewrites and
improved versions of the @code{mh} tools. Most Linux systems will
install this over the old @code{mh}.

@noindent
{@sf{Debian}}: @file{nmh}

@noindent
{@sf{WWW}}: @url{http://www.mhost.com/nmh/}

@item @code{vm}
@tab VM (``View Mail'') is a facility for reading and sending mail in
Emacs. Older than @code{gnus} and @code{mew}, it is very configurable.

@noindent
{@sf{Debian}}: @file{vm}

@noindent
{@sf{WWW}}: @url{http://www.wonderworks.com/vm/}

@item @code{wl}
@tab Wanderlust is a MUA for Emacs designed to facilitate reading your
mail on multiple computers.

@noindent
{@sf{Debian}}: @file{wl}

@noindent
{@sf{WWW}}: @url{http://www.gohome.org/wl/}
@end multitable