<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tim's blog (Posts about mail)</title><link>https://blog.thechases.com</link><description></description><atom:link href="https://blog.thechases.com/categories/mail.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:blog@tim.thechases.com"&gt;Tim Chase&lt;/a&gt; </copyright><lastBuildDate>Sat, 21 Feb 2026 00:24:27 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Using mail(1)</title><link>https://blog.thechases.com/posts/using-mail/</link><dc:creator>Tim Chase</dc:creator><description>&lt;h2 id="intro"&gt;Intro&lt;/h2&gt;

&lt;figure&gt;
&lt;pre&gt;
CONGRATULATIONS! Your OpenBSD install has been successfully completed!

When you login to your new system the first time, please read your mail
using the 'mail' command.
&lt;/pre&gt;
&lt;figcaption&gt;&lt;a href="https://openbsd.org"&gt;OpenBSD&lt;/a&gt;'s
post-install message&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Oh, no!

You have a fresh install
and the only way to read
your welcome message from Theo
requires using
&lt;code&gt;mail&lt;/code&gt;.

&lt;!-- TEASER_END --&gt;

Or perhaps you've exited some long-running program
and your shell informs you
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
You have mail in /var/mail/&lt;var&gt;$USER&lt;/var&gt;
&lt;/pre&gt;
&lt;/figure&gt;

&lt;p&gt;
However, upon launching
&lt;code&gt;mail&lt;/code&gt;,
most users find that the interface has all the friendliness of
&lt;a href="https://blog.thechases.com/posts/cli/unsorted-ed-tips-and-tricks/"&gt;&lt;code&gt;ed(1)&lt;/code&gt;&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
For decades,
Unix-like systems have offered
&lt;a href="https://man.openbsd.org/mail.1"&gt;&lt;code&gt;mail(1)&lt;/code&gt;&lt;/a&gt;
as a way to read the system mailbox
and send mail.
While not as flashy or featureful as more modern
&lt;abbr title="Mail User Agent"&gt;MUA&lt;/abbr&gt;s
like
&lt;a href="https://www.sdaoden.eu/code.html#s-nail"&gt;s-nail&lt;/a&gt;,
&lt;a href="http://mutt.org"&gt;Mutt&lt;/a&gt;,
&lt;a href="https://neomutt.org"&gt;NeoMutt&lt;/a&gt;,
&lt;a href="https://alpineapp.email/"&gt;Alpine&lt;/a&gt;,
or
&lt;a href="https://aerc-mail.org/"&gt;Aerc&lt;/a&gt;
(or even graphical MUAs like
&lt;a href="https://claws-mail.org/"&gt;Claws Mail&lt;/a&gt;,
&lt;a href="https://www.thunderbird.net/"&gt;Thunderbird&lt;/a&gt;,
&lt;a href="https://apps.kde.org/kmail2/"&gt;KMail&lt;/a&gt;,
or Gnome
&lt;a href="https://wiki.gnome.org/Apps/Evolution"&gt;Evolution&lt;/a&gt;),
it provides a surprising bit of functionality
hidden under the hood.
&lt;/p&gt;

&lt;h2 id="history"&gt;History&lt;/h2&gt;

&lt;p&gt;
Over the years,
a variety of
&lt;abbr title="Command Line Interface"&gt;CLI&lt;/abbr&gt;
programs have called themselves some form of "mail",
including
&lt;code&gt;mail&lt;/code&gt;,
&lt;code title="Note the capital M"&gt;Mail&lt;/code&gt;,
&lt;code&gt;mailx&lt;/code&gt;,
&lt;code&gt;heirloom-mail&lt;/code&gt;,
and
&lt;code&gt;s-nail&lt;/code&gt;,
with subtle differences in each of them.
For purposes of this post,
I'll try to stick mostly to
&lt;code&gt;mail&lt;/code&gt;/&lt;code&gt;mailx&lt;/code&gt;,
&lt;a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mailx.html"&gt;as defined by POSIX&lt;/a&gt;
which means
&lt;/p&gt;&lt;ul&gt;
 &lt;li&gt;
  no IMAP/POP/SMTP support
 &lt;/li&gt;
 &lt;li&gt;
  no Maildir or MH support,
  only classic
  &lt;code&gt;mbox&lt;/code&gt;
  format
 &lt;/li&gt;
 &lt;li&gt;
  no built-in spam filtering
 &lt;/li&gt;
 &lt;li&gt;
  no threading
 &lt;/li&gt;
 &lt;li&gt;
  no native support for
  &lt;abbr title="Multipurpose Internet Mail Extensions"&gt;MIME&lt;/abbr&gt;
  types other than
  &lt;code&gt;text/plain&lt;/code&gt;
  (so no
  &lt;code&gt;text/html&lt;/code&gt;)
 &lt;/li&gt;
&lt;/ul&gt;
that you might find in some iterations such as
&lt;a href="https://heirloom.sourceforge.net/mailx.html"&gt;heirloom
&lt;code&gt;mailx&lt;/code&gt;&lt;/a&gt;.

Specifically, all examples here
should work in
&lt;code&gt;mail&lt;/code&gt;
as provided by
&lt;a href="https://freebsd.org"&gt;FreeBSD&lt;/a&gt;
&amp;amp;
&lt;a href="https://openbsd.org"&gt;OpenBSD&lt;/a&gt;
base systems.


&lt;p&gt;
This post assumes some
&lt;a href="https://blog.thechases.com/posts/using-mail/#system-configuration"&gt;basic system configuration&lt;/a&gt;
and will discuss the three essential modes of operation:
&lt;/p&gt;&lt;ol&gt;
 &lt;li&gt;&lt;a href="https://blog.thechases.com/posts/using-mail/#mode-send"&gt;send mode&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;
  interactive
  &lt;a href="https://blog.thechases.com/posts/using-mail/#mode-read"&gt;mail reading mode&lt;/a&gt;,
  and
  &lt;/li&gt;
 &lt;li&gt;&lt;a href="https://blog.thechases.com/posts/using-mail/#mode-composition"&gt;mail composition mode&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
Additionally, this post will cover some common
&lt;a href="https://blog.thechases.com/posts/using-mail/#settings"&gt;configuration settings&lt;/a&gt;
as well as some
&lt;a href="https://blog.thechases.com/posts/using-mail/#tips"&gt;tips &amp;amp; tricks&lt;/a&gt;.


&lt;h2 id="system-configuration"&gt;System configuration expectations&lt;/h2&gt;

&lt;p&gt;
By default,
most Linux &amp;amp; BSD systems provide
local mail receipt &amp;amp; delivery
out of the box on a fresh install,
whether with
&lt;a href="https://www.proofpoint.com/us/products/open-source-email-solution" &lt;code&gt;sendmail&lt;/a&gt;,
&lt;a href="https://www.exim.org/"&gt;&lt;code&gt;exim&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://www.postfix.org/"&gt;Postfix&lt;/a&gt;,
or my favorite,
&lt;a href="https://opensmtpd.org/"&gt;OpenSMTPD&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
To exchange mail with external systems,
you'll have to configure your
&lt;abbr title="Mail Transfer Agent"&gt;MTA&lt;/abbr&gt;
as well as possibly modify your
&lt;abbr title="Domain Name System"&gt;DNS&lt;/abbr&gt;
to point your
&lt;abbr title="Mail Exchange"&gt;MX&lt;/abbr&gt;
record at your server,
set up
&lt;a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework"&gt;&lt;abbr title="Sender Policy Framework"&gt;SPF&lt;/abbr&gt;&lt;/a&gt;
&amp;amp;
&lt;a href="https://en.wikipedia.org/wiki/DMARC"&gt;&lt;abbr title="Domain-based Message Authentication, Reporting and Conformance"&gt;DMARC&lt;/abbr&gt;&lt;/a&gt;
and you might want some sort of spam-filtering solution in place.

However, since MTA choice &amp;amp; configuration
fall outside the scope of this post,
use whatever you prefer
as long as your
&lt;abbr title="Mail Delivery Agent"&gt;MDA&lt;/abbr&gt;
delivers to the user's system
&lt;code&gt;mbox&lt;/code&gt;
(usually
&lt;code&gt;/var/mail/&lt;var&gt;$USER&lt;/var&gt;&lt;/code&gt;
or
&lt;code&gt;/var/spool/mail/&lt;var&gt;$USER&lt;/var&gt;&lt;/code&gt;)
and your MTA has compatibility with
&lt;code&gt;sendmail&lt;/code&gt;
(usually done through a binary or link at
&lt;code&gt;/usr/sbin/sendmail&lt;/code&gt;).
&lt;/p&gt;

&lt;p&gt;
Finally,
&lt;code&gt;mail&lt;/code&gt;
assumes that it can lock mailboxes
at the file-system level.
On local file-systems,
this doesn't generally pose a problem.
&lt;span class="warning"&gt;
However, if your system
&lt;code&gt;mbox&lt;/code&gt;
resides on an
&lt;abbr title="Network File System"&gt;NFS&lt;/abbr&gt;
share with unreliable locking,
you may encounter issues/conflicts
if more than one process attempts to modify the mailbox.
&lt;/span&gt;
&lt;/p&gt;

&lt;h2 id="modes"&gt;Essential modes of operation&lt;/h2&gt;

&lt;h3 id="mode-send"&gt;Send mode&lt;/h3&gt;

&lt;p&gt;
The most simple of the modes,
this expects the email message body on
&lt;tt&gt;stdin&lt;/tt&gt;,
an optional subject passed with the
&lt;code&gt;-s&lt;/code&gt;
option,
&lt;abbr title="Carbon Copy"&gt;CC&lt;/abbr&gt;
&amp;amp;
&lt;abbr title="Blind Carbon Copy"&gt;BCC&lt;/abbr&gt;
fields with the
&lt;code&gt;-c&lt;/code&gt;
&amp;amp;
&lt;code&gt;-b&lt;/code&gt;
options,
followed by the list of recipient(s).
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;echo "ask about surgery" |
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;mail -s "Call Mom" &lt;var&gt;$USER&lt;/var&gt;&lt;/kbd&gt;

&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;calendar |
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;mail -s "Our calendar for $(date +"%Y-%m-%d")" \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;&lt;var&gt;me@example.net&lt;/var&gt; &lt;var&gt;spouse@example.net&lt;/var&gt;&lt;/kbd&gt;

&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;git log -10 |
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;mail -s "&lt;var&gt;What I've done this week&lt;/var&gt;" \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;-b &lt;var&gt;owner@example.com&lt;/var&gt; \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;-c &lt;var&gt;boss@example.com&lt;/var&gt; \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt;&lt;var&gt;coworker@example.com&lt;/var&gt;&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;
Examples of using
&lt;code&gt;mail&lt;/code&gt;
in command pipelines
&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Send mode works well in scripts
to email output of commands,
and often
&lt;code&gt;cron&lt;/code&gt;
&amp;amp;
&lt;code&gt;at&lt;/code&gt;
use
&lt;code&gt;mail&lt;/code&gt;
to send the results of each task to the owner.
&lt;/p&gt;

&lt;p&gt;
If
&lt;code&gt;mail&lt;/code&gt;
reads from an interactive terminal,
it affords
&lt;a href="https://blog.thechases.com/posts/using-mail/#tilde-escapes"&gt;tilde-escape&lt;/a&gt;
operations for editing the message.
When finished with the message,
use an
&lt;abbr title="End Of File"&gt;EOF&lt;/abbr&gt;
with
&lt;kbd&gt;&lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;d&lt;/kbd&gt;&lt;/kbd&gt;
to send the message.
&lt;/p&gt;

&lt;h3 id="mode-read"&gt;Mail reading mode&lt;/h3&gt;

&lt;h4 id="read-start"&gt;Starting &lt;code&gt;mail&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;
If you currently have mail in your system mailbox,
POSIX shells should inform you (roughly) every
&lt;code&gt;$MAILCHECK&lt;/code&gt;
seconds
(default=600, or 10 minutes)
if the last-modified time
of the system mailbox
(as specified by
&lt;code&gt;$MAIL&lt;/code&gt;)
has changed.

Launching
&lt;code&gt;mail&lt;/code&gt;
with no arguments opens
&lt;code&gt;mail&lt;/code&gt;,
&lt;a href="https://blog.thechases.com/posts/using-mail/#setting-header"&gt;displays
a screenful of message headers&lt;/a&gt;,
and leaves you at an
"&lt;tt&gt;&amp;amp;&lt;/tt&gt;"
prompt.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="visual"&gt;⋮&lt;/label&gt;
You have mail in /var/mail/demo
&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;mail&lt;/kbd&gt;
Mail version &lt;var&gt;8.1.2 01/15/2001&lt;/var&gt;.  Type ? for help.
"/var/mail/demo": 2 messages 2 new
&amp;gt;N  1 root@example.com  Thu Dec 15 01:30   29/931   example.com daily
 N  2 root@example.com  Fri Dec 23 01:30   32/963   example.com daily
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;
Example of how
&lt;code&gt;mail&lt;/code&gt;
greets you
&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h4 id="read-stop"&gt;Exiting &lt;code&gt;mail&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;
To quit back to your shell without modifying the mailbox,
use the
&lt;kbd&gt;x&lt;/kbd&gt;/&lt;kbd&gt;exit&lt;/kbd&gt;
command.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;x&lt;/kbd&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;quitting&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
If you use the
&lt;kbd&gt;q&lt;/kbd&gt;/&lt;kbd&gt;quit&lt;/kbd&gt;
command or type
&lt;kbd&gt;&lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;d&lt;/kbd&gt;&lt;/kbd&gt;
to send an
&lt;abbr title="end of file"&gt;EOF&lt;/abbr&gt;,
it will change the message status of unread messages from
&lt;samp&gt;N&lt;/samp&gt;
(new)
to
&lt;samp&gt;U&lt;/samp&gt;
(unread).
By default,
if you have read any of the messages in your system mailbox,
they will get moved to
&lt;code&gt;~/mbox&lt;/code&gt;
upon quitting with
&lt;kbd&gt;q&lt;/kbd&gt;.
The
&lt;a href="https://blog.thechases.com/posts/using-mail/#setting-hold"&gt;&lt;code&gt;hold&lt;/code&gt;&lt;/a&gt;
setting prevents
&lt;code&gt;mail&lt;/code&gt;
from moving messages out of the system mailbox
unless you explicitly (re)move them.
&lt;/p&gt;

&lt;h4 id="read-list"&gt;Listing messages&lt;/h4&gt;

&lt;p&gt;
By default,
when
&lt;code&gt;mail&lt;/code&gt;
starts up,
it shows you a screenful of message-summaries,
one per line.
Each message has an identifying number/index
that should remain valid for the entire session.
The header-listing consists of the following fields:
&lt;/p&gt;&lt;ul&gt;
 &lt;li&gt;
  flags
  (&lt;strong&gt;N&lt;/strong&gt;ew,
  &lt;strong&gt;U&lt;/strong&gt;nread,
  &lt;strong&gt;P&lt;/strong&gt;reserved,
  &lt;strong&gt;M&lt;/strong&gt; send to
   &lt;code&gt;mbox&lt;/code&gt;,
  and
  &lt;strong&gt;*&lt;/strong&gt;
  saved)
  &lt;/li&gt;
 &lt;li&gt;message index&lt;/li&gt;
 &lt;li&gt;sender&lt;/li&gt;
 &lt;li&gt;date&lt;/li&gt;
 &lt;li&gt;size (in lines and bytes)&lt;/li&gt;
 &lt;li&gt;subject&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;
If you have more than one screenful of messages,
you can use the
&lt;kbd&gt;z&lt;/kbd&gt;
command to list the next screenful,
&lt;kbd&gt;z-&lt;/kbd&gt;
to list the previous screenful,
and
&lt;kbd&gt;h&lt;/kbd&gt;
to re-display the current screenful.
When you first start
&lt;code&gt;mail&lt;/code&gt;,
it displays the first page of message-summaries
as if you had typed
&lt;kbd&gt;h&lt;/kbd&gt;.
&lt;/p&gt;

&lt;p&gt;
To list message summaries matching particular criteria,
you can use the
&lt;kbd&gt;f&lt;/kbd&gt;/&lt;kbd&gt;from&lt;/kbd&gt;
command with a message-list filter.
Message-list filters can consist of a single message number,
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f 5&lt;/kbd&gt;
 N  5 root@example.com  Thu Dec 15 01:30   29/931   example.com daily
&lt;/pre&gt;
&lt;figcaption&gt;show summary for message 5&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
multiple message numbers,
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f 5 7 9&lt;/kbd&gt;
 N  5 root@example.com  Thu Dec 15 01:30   29/931   example.com daily
 N  7 root@example.com  Sat Jan  7 00:08   22/1191  Cron &amp;lt;upload@example.com&amp;gt;
 N  9 root@example.com  Sat Jan  7 00:17 13789/971549 Cron &amp;lt;upload@example.com&amp;gt;
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages 5, 7, and 9&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
or a range of numbers:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f 5-8&lt;/kbd&gt;
 N  5 root@example.com  Thu Dec 15 01:30   29/931   example.com daily
 N  7 root@example.com  Sat Jan  7 00:08   22/1191  Cron &amp;lt;upload@example.com&amp;gt;
 N  8 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages 5–8&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
You can use a
&lt;kbd&gt;$&lt;/kbd&gt;
to indicate the last message in the mailbox:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f 7-$&lt;/kbd&gt;
 N  7 root@example.com  Sat Jan  7 00:08   22/1191  Cron &amp;lt;@example.com&amp;gt;
 N  8 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
 N  9 root@example.com  Sat Jan  7 00:17 13789/971549 Cron &amp;lt;upload@example.com&amp;gt;
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages 7 through the last one&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
These can combine to list particular messages by number &amp;amp; range:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f 2 4-6 8-$&lt;/kbd&gt;
    2 root@example.com  Wed Dec 14 01:30   29/931   example.com daily
 U  4 tim               Wed Dec 14 21:11   16/597   Call Mom
 N  5 root@example.com  Thu Dec 15 01:30   29/931   example.com daily
 N  8 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
 N  9 root@example.com  Sat Jan  7 00:17 13789/971549 Cron &amp;lt;upload@example.com&amp;gt;
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages 2, 4–6, and 8 through the last one&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
If you want to refer to all messages in the mailbox,
you can use
&lt;kbd&gt;*&lt;/kbd&gt;
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f *&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;show summary for every message in the mailbox&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
though this may scroll past
if you have more than one screenful of messages.
&lt;/p&gt;

&lt;p&gt;
Additionally, you can list messages by category of message
&lt;/p&gt;&lt;dl class="compact"&gt;
&lt;dt&gt;&lt;kbd&gt;:d&lt;/kbd&gt;&lt;/dt&gt;&lt;dd&gt;deleted messages&lt;/dd&gt;
&lt;dt&gt;&lt;kbd&gt;:n&lt;/kbd&gt;&lt;/dt&gt;&lt;dd&gt;new messages&lt;/dd&gt;
&lt;dt&gt;&lt;kbd&gt;:o&lt;/kbd&gt;&lt;/dt&gt;&lt;dd&gt;old messages&lt;/dd&gt;
&lt;dt&gt;&lt;kbd&gt;:r&lt;/kbd&gt;&lt;/dt&gt;&lt;dd&gt;read messages&lt;/dd&gt;
&lt;dt&gt;&lt;kbd&gt;:u&lt;/kbd&gt;&lt;/dt&gt;&lt;dd&gt;unread messages&lt;/dd&gt;
&lt;/dl&gt;
There's a subtle difference between
"new" and "old" messages
that might matter to some users,
but that distinction has never mattered much to me.


&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f :r&lt;/kbd&gt;
    2 root@example.com  Wed Dec 14 01:30   29/931   example.com daily
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages that you have read&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Finally, you can list messages by searching.
If you use a regular string,
&lt;code&gt;mail&lt;/code&gt;
will search the "From" header for mail from that recipient:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f bob@example.edu&lt;/kbd&gt;
 N  8 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages from bob@example.edu&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
You can use partial matching as well:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f bob&lt;/kbd&gt;
 N  8 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages from senders containing "bob"&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
If you prefix the search string with a
&lt;kbd&gt;/&lt;/kbd&gt;,
it will search messages' Subject field:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;f /thesis&lt;/kbd&gt;
 N  8 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
&lt;/pre&gt;
&lt;figcaption&gt;show summary for messages where the subject contains "thesis"&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h4 id="read-print"&gt;Displaying messages&lt;/h4&gt;

&lt;p&gt;
To display a message,
use the
&lt;kbd&gt;p&lt;/kbd&gt;/&lt;kbd&gt;print&lt;/kbd&gt;
command.
Without a message-list following the
&lt;kbd&gt;p&lt;/kbd&gt;/&lt;kbd&gt;print&lt;/kbd&gt;
command,
&lt;code&gt;mail&lt;/code&gt;
will print the message headers and the body
of the current message.
If the length of the message exceeds the height of the screen
(or the value of the
&lt;code&gt;crt&lt;/code&gt;
setting, if set),
the headers and body will get sent to your
&lt;code&gt;$PAGER&lt;/code&gt;.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;p &lt;var&gt;8&lt;/var&gt;&lt;/kbd&gt;
Message 8:
From bob@example.edu Sat Jan  7 00:08:53 2023
Return-Path: &amp;lt;bob@example.edu&amp;gt;
X-Original-To: demo@example.net
Delivered-To: demo@example.net
Received: by example.net (Postfix, from userid 1234)
        id 533AC0FFEE; Sat,  7 Jan 2023 00:08:53 +0000 (UTC)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-Id: &amp;lt;20230125170817.533AC0FFEE@example.edu&amp;gt;
Date: Sat Jan  7 00:08:53 2023 -0600 (CST)
From: Professor Bob &amp;lt;bob@example.edu&amp;gt;
To: demo@example.net
Subject: Comments on your thesis

Wow, I've never seen such rubbish.
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;printing message #8&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p id="retain"&gt;
A lot of headers clutter that output,
so I often use
&lt;code&gt;retain&lt;/code&gt;
(or
&lt;code&gt;ignore&lt;/code&gt;)
to winnow these to what I care about.
I 
&lt;code&gt;retain&lt;/code&gt;
only those headers I want to see:
&lt;/p&gt;
&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;&lt;mark&gt;retain &lt;var&gt;cc date subject&lt;/var&gt;&lt;/mark&gt;&lt;/kbd&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;p &lt;var&gt;8&lt;/var&gt;&lt;/kbd&gt;
Message 8:
From bob@example.edu Sat Jan  7 00:08:53 2023
Date: Sat Jan  7 00:08:53 2023 -0600 (CST)
Subject: Comments on your thesis

Wow, I've never seen such rubbish.
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;setting retained headers&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Much better.
Well, except for the quality of the thesis.
&lt;/p&gt;

&lt;p&gt;
After using
&lt;code&gt;retain&lt;/code&gt;,
if you subsequently want to see
&lt;strong&gt;all&lt;/strong&gt;
the headers,
you can use the
&lt;kbd&gt;P&lt;/kbd&gt;/&lt;kbd&gt;Print&lt;/kbd&gt;
(with a capital "P")
command.
&lt;/p&gt;

&lt;h4 id="read-delete"&gt;Deleting (and undeleting) messages&lt;/h4&gt;

&lt;p&gt;
The
&lt;kbd&gt;d&lt;/kbd&gt;/&lt;kbd&gt;delete&lt;/kbd&gt;
command deletes the current message,
while
&lt;kbd&gt;u&lt;/kbd&gt;/&lt;kbd&gt;undelete&lt;/kbd&gt;
undeletes a deleted message.
Both accept a list of message-IDs
like the
&lt;a href="https://blog.thechases.com/posts/using-mail/#read-print"&gt;&lt;code&gt;print&lt;/code&gt;&lt;/a&gt;
command.
You can undelete messages
as long as you haven't closed
the current mailbox file.
If you accidentally delete a bunch of messages
remember you can always use
&lt;a href="https://blog.thechases.com/posts/using-mail/#read-stop"&gt;&lt;kbd&gt;x&lt;/kbd&gt;&lt;/a&gt;
to quit safely without writing any changes,
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;d &lt;var&gt;3 8 5&lt;/var&gt;&lt;/kbd&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;u &lt;var&gt;/thesis&lt;/var&gt;&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;deleting &amp;amp; undeleting messages&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h4 id="read-reply"&gt;Replying to messages&lt;/h4&gt;

&lt;p&gt;
After reading a message,
you can use the
&lt;kbd&gt;r&lt;/kbd&gt;/&lt;kbd&gt;reply&lt;/kbd&gt;
command to reply to all the recipients,
or the
&lt;kbd&gt;R&lt;/kbd&gt;/&lt;kbd&gt;Reply&lt;/kbd&gt;
command to reply only to the author of the message.
By default,
&lt;code&gt;mail&lt;/code&gt;
doesn't include the original message,
so you may want to use the
&lt;a href="https://blog.thechases.com/posts/using-mail/#tilde-m"&gt;&lt;kbd&gt;~m&lt;/kbd&gt;&lt;/a&gt;
command to read the current message
into the reply,
prefixed with
&lt;code&gt;indentprefix&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
The section on
&lt;a href="https://blog.thechases.com/posts/using-mail/#mail-composition"&gt;mail composition&lt;/a&gt;
has more details on how to edit your reply.
&lt;/p&gt;

&lt;h4 id="read-compose"&gt;Composing new messages&lt;/h4&gt;

&lt;p&gt;
To compose a new message from within
&lt;code&gt;mail&lt;/code&gt;,
use the
&lt;kbd&gt;m&lt;/kbd&gt;/&lt;kbd&gt;mail&lt;/kbd&gt;
command,
specifying the recipient.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;mail &lt;var&gt;customerservice@example.com&lt;/var&gt;&lt;/kbd&gt;
Subject: &lt;kbd&gt;broken frobniculator
I bought a new frobniculator last week
but it broke within the first 10 minutes
of use.

How can I obtain a replacement?

Thanks!
.&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;composing a new message&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
The section on
&lt;a href="https://blog.thechases.com/posts/using-mail/#mail-composition"&gt;mail composition&lt;/a&gt;
has more details on how to compose your message.
&lt;/p&gt;

&lt;h4 id="read-save"&gt;Filing messages&lt;/h4&gt;

&lt;p&gt;
Once you have read a message,
rather than delete it,
you may prefer to file it
in a separate mbox archive
so it doesn't clutter your main inbox.
Use the
&lt;kbd&gt;s&lt;/kbd&gt;/&lt;kbd&gt;save&lt;/kbd&gt;
command to specify an mbox file.
You can specify a message-list between the
&lt;kbd&gt;save&lt;/kbd&gt;
command and the mbox filename
to save multiple messages
in one command.
&lt;/p&gt;

&lt;p&gt;
Alternatively,
if you would like to save a
&lt;em&gt;copy&lt;/em&gt;
of the message,
while keeping the original
in the current mailbox,
use the
&lt;kbd&gt;c&lt;/kbd&gt;/&lt;kbd&gt;copy&lt;/kbd&gt;
command which has the same syntax as
&lt;kbd&gt;save&lt;/kbd&gt;.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;p &lt;var&gt;/thesis&lt;/var&gt;&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;s &lt;var&gt;thesis&lt;/var&gt;&lt;/kbd&gt;
"thesis" [New file]
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;copy &lt;var&gt;10 12&lt;/var&gt; &lt;var&gt;bills&lt;/var&gt;&lt;/kbd&gt;
"bills" [Appended]
&lt;/pre&gt;
&lt;figcaption&gt;filing messages in another folder&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h4 id="read-changing-mailboxes"&gt;Changing mailboxes&lt;/h4&gt;

&lt;p&gt;
Great.
Now you can read mail
from your system mailbox.
And you can file mail in other mbox stores.
How do you access those folders?
You can either specify it on the shell command-line with
&lt;kbd&gt;-f&lt;/kbd&gt;
or within mail using the
&lt;kbd&gt;file&lt;/kbd&gt;
command.
The
&lt;a href="https://blog.thechases.com/posts/using-mail/#setting-folder"&gt;&lt;code&gt;folder&lt;/code&gt; setting&lt;/a&gt;
allows you to prefix a folder-name with "+"
to refer to mbox stores in that folder
regardless of your current working-directory.
Additionally, you can use
"%" to refer to your system mailbox,
"#" to refer to the previous folder you had open,
and "&amp;amp;" to refer to your
&lt;a href="https://blog.thechases.com/posts/using-mail/#setting-mbox"&gt;&lt;code&gt;MBOX&lt;/code&gt; folder&lt;/a&gt;.
&lt;/p&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;set folder="mail"&lt;/kbd&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;copy &lt;var&gt;8&lt;/var&gt; +&lt;var&gt;thesis&lt;/var&gt;&lt;/kbd&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;folders&lt;/kbd&gt;
bills   thesis
&lt;/pre&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;mail -f &lt;var&gt;thesis&lt;/var&gt;&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;folders&lt;/kbd&gt;
bills   thesis
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;file +&lt;var&gt;bills&lt;/var&gt;&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮ &lt;var&gt;# messages from the "bills" folder&lt;/var&gt;&lt;/label&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;file %&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮ &lt;var&gt;# messages in the $MAIL spool&lt;/var&gt;&lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;opening different mailboxes&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h4 id="checking-for-new-mail"&gt;Checking for new mail&lt;/h4&gt;

&lt;p&gt;
While in a
&lt;code&gt;mail&lt;/code&gt;
session,
new mail might arrive in your system mailbox
(or an external process might have modified
your current folder).
Use the
&lt;code&gt;inc&lt;/code&gt;
command to "incorporate" new mail.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;h&lt;/kbd&gt;
 N  1 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;inc&lt;/kbd&gt;
"/var/mail/&lt;var&gt;$USER&lt;/var&gt;": 2 messages 2 new
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;h&lt;/kbd&gt;
 N  1 bob@example.edu   Sat Jan  7 00:08   32/1625  Comments on your thesis
 N  2 bob@example.edu   Sat Jan  9 11:33   48/2158  More comments
&lt;/pre&gt;
&lt;figcaption&gt;Incorporating new mail&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3 id="mode-composition"&gt;Mail composition mode&lt;/h3&gt;

&lt;p&gt;
When creating a new message,
either via the shell
&lt;/p&gt;&lt;pre&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;mail -s "My subj" user@example.com&lt;/kbd&gt;
&lt;/pre&gt;
or
&lt;code&gt;mail&lt;/code&gt;
command-line
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;m user@example.com&lt;/kbd&gt;
Subject: &lt;kbd&gt;My subject&lt;/kbd&gt;
&lt;/pre&gt;
by default
&lt;code&gt;mail&lt;/code&gt;
lets you enter your message
one line at time
and terminate it with a period or EOF:
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;m bob@example.edu&lt;/kbd&gt;
Subject: &lt;kbd&gt;thesis feedback
Thanks for your helpful feedback.
.&lt;/kbd&gt;
&lt;/pre&gt;


&lt;h4 id="tilde-escapes"&gt;Tilde escapes&lt;/h4&gt;

&lt;p&gt;
While convenient to type your message
and send it,
sometimes you want to edit the message
in your
&lt;code&gt;$EDITOR&lt;/code&gt;,
revise the list of recipients,
change the Subject line,
or include a message's contents
for a point-by-point reply.
By entering a message-body line
beginning with a tilde
followed by a command-letter,
&lt;code&gt;mail&lt;/code&gt;
lets you make such modifications.
And if you want to abandon the message,
use the
&lt;kbd&gt;~q&lt;/kbd&gt;
command to save the draft in
&lt;code&gt;~/dead.letter&lt;/code&gt;,
or use the
&lt;kbd&gt;~x&lt;/kbd&gt;
to abandon the message completely.
If you saved a draft,
you can read it back in with
&lt;kbd&gt;~d&lt;/kbd&gt;.
&lt;/p&gt;

&lt;p&gt;
Using
&lt;kbd&gt;~?&lt;/kbd&gt;
will give you the full list of allowed
tilde commands.
&lt;/p&gt;

&lt;p&gt;
Use
&lt;kbd&gt;~t &lt;var&gt;recipient&lt;/var&gt;&lt;/kbd&gt;,
&lt;kbd&gt;~c &lt;var&gt;recipient&lt;/var&gt;&lt;/kbd&gt;,
and
&lt;kbd&gt;~b &lt;var&gt;recipient&lt;/var&gt;&lt;/kbd&gt;
to add recipients
to the
"To:",
"CC:",
and
"BCC:"
recipient-lists respectively.
The
&lt;kbd&gt;~s&lt;/kbd&gt;
lets you edit your "Subject:" header.
Or use
&lt;kbd&gt;~h&lt;/kbd&gt;
to edit each header in turn.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;reply /thesis
~c dean@example.edu
Hey, Bob,
Copying the dean to get her input.&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;/pre&gt;
&lt;figcaption&gt;adding to the CC list&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Most usefully,
the
&lt;kbd&gt;~e&lt;/kbd&gt;
and
&lt;kbd&gt;~v&lt;/kbd&gt;
commands let you edit the current message
in your
&lt;code&gt;$EDITOR&lt;/code&gt;
and your
&lt;code&gt;$VISUAL&lt;/code&gt;
editors respectively.
When you return from your editor,
you can continue to append to the message where you left off.
To display the message as it currently stands,
use the
&lt;kbd&gt;~p&lt;/kbd&gt;
tilde command.
&lt;/p&gt;

&lt;p&gt;
As with other mailers,
sometimes you want to include the content of other messages.
The
&lt;kbd&gt;~f &lt;var&gt;message-list&lt;/var&gt;&lt;/kbd&gt;
&amp;amp;
&lt;kbd id="tilde-m"&gt;~m &lt;var&gt;message-list&lt;/var&gt;&lt;/kbd&gt;
commands let you read one or more messages
from your current mailbox
into the current message.
If you omit the
&lt;kbd&gt;&lt;var&gt;message-list&lt;/var&gt;&lt;/kbd&gt;,
&lt;code&gt;mail&lt;/code&gt;
uses the current message.
If you have set the
&lt;code&gt;indentprefix&lt;/code&gt;
option
(I recommend the internet standard "&amp;gt; "),
the
&lt;kbd&gt;~m&lt;/kbd&gt;
will prefix each line with the corresponding value:
&lt;/p&gt;&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;set indentprefix="&amp;gt; "&lt;/kbd&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;m bob@example.edu&lt;/kbd&gt;
Subject: &lt;kbd&gt;thesis feedback
~m /thesis

Thanks for your helpful feedback.
.&lt;/kbd&gt;
&lt;/pre&gt;
as commonly used for replies.
By default,
only the
&lt;a href="https://blog.thechases.com/posts/using-mail/retain"&gt;retain&lt;/a&gt;ed
headers get included.
If you want
&lt;strong&gt;all&lt;/strong&gt;
the headers,
use the uppercase versions
&lt;kbd&gt;~F&lt;/kbd&gt;
&amp;amp;
&lt;kbd&gt;~M&lt;/kbd&gt;
instead.


&lt;p&gt;
Alternatively, you might want to read
output from an external file
(with
&lt;kbd&gt;~r &lt;var&gt;filename&lt;/var&gt;&lt;/kbd&gt;)
or command
(with
&lt;kbd&gt;~! &lt;var&gt;command&lt;/var&gt;&lt;/kbd&gt;)
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;m &lt;var&gt;jsmith@example.net&lt;/var&gt;&lt;/kbd&gt;
Subject: &lt;kbd&gt;having trouble with my Acme frobniculator interface
I had trouble loading the firmware.
Here's my dmesg output:
~! dmesg

and my config file:
~r /etc/acme-frobniculator

Could you point me in the right direction?

Thanks!&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;including files and command-output in a message&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Finally, sometimes you want
to pass your message
through an external utility
like
&lt;code&gt;rot13(6)&lt;/code&gt;,
&lt;code&gt;b1ff(6)&lt;/code&gt;,
or a spell-check utility.
The
&lt;kbd&gt;~| &lt;var&gt;command&lt;/var&gt;&lt;/kbd&gt;
command lets you filter the message.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;m &lt;var&gt;unclejoe@example.mil&lt;/var&gt;&lt;/kbd&gt;
Subject: &lt;kbd&gt;dirty joke

mud, mud, mud
~| rot13&lt;/kbd&gt;
(continue)
&lt;kbd&gt;~p&lt;/kbd&gt;
-------
Message contains:
To: unclejoe@example.mil
Subject: joke

zhq, zhq, zhq
(continue)
&lt;/pre&gt;
&lt;figcaption&gt;including files and command-output in a message&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
&lt;span class="warning"&gt;Beware: if editing over &lt;code&gt;ssh&lt;/code&gt;&lt;/span&gt;
Both
&lt;code&gt;mail&lt;/code&gt;
&amp;amp;
&lt;code&gt;ssh&lt;/code&gt;
use tilde-escapes at the beginning of the line.
To send a tilde over
&lt;code&gt;ssh&lt;/code&gt;
you may have to hit
&lt;kbd&gt;~&lt;/kbd&gt;
twice to send the tilde to
&lt;code&gt;mail&lt;/code&gt;.
&lt;/p&gt;

&lt;h2 id="alias-files"&gt;Address book&lt;/h2&gt;

&lt;p&gt;
Not having the best memory,
I prefer to let my computer keep track of contacts.
I want to type "john" as the recipient
and let my mail program figure out who I mean.
Do I want to forget any family members
when sending out important family-wide updates?
No way!
The "alias" file contains tuples beginning with the keyword
&lt;code&gt;alias&lt;/code&gt;
followed by the nickname you want to use,
and one or more addresses to expand into.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;cat ~/aliases&lt;/kbd&gt;
alias mom mom@example.net
alias dad dad@example.net
alias john john@example.com
alias joe unclejoe@example.mil
alias family john, joe, mom, dad
alias bob bob@example.edu
alias dean dean@example.edu
alias thesis bob, dean
&lt;/pre&gt;
&lt;figcaption&gt;a sample alias file&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
This lets me compose a message to "john" or "family"
and have
&lt;code&gt;mail&lt;/code&gt;
expand to the correct addresses.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;mail family&lt;/kbd&gt;
Subject: &lt;kbd&gt;Family crisis
Joe ate all the ice cream again!
.
&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;using an alias&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id="settings"&gt;Settings&lt;/h2&gt;

&lt;p&gt;
Your
&lt;code&gt;~/.mailrc&lt;/code&gt;
file can contain startup commands &amp;amp; settings
to tweak the behavior of
&lt;code&gt;mail&lt;/code&gt;
so this section covers the ones I find useful.
I've included my
&lt;code&gt;~/.mailrc&lt;/code&gt;
below as an example.
&lt;/p&gt;

&lt;p&gt;
As listed above,
I set my
&lt;code&gt;retain&lt;/code&gt;
to a very small subset of headers
that I actually want to see,
usually
"Subject",
"Date",
and "CC".
&lt;/p&gt;

&lt;dl&gt;

&lt;dt id="setting-crt"&gt;&lt;code&gt;crt&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
By default,
&lt;code&gt;mail&lt;/code&gt;
determines the number of lines based on the display device
and uses this to determine when to pass the output through
&lt;code&gt;$PAGER&lt;/code&gt;
for display.
Setting
&lt;code&gt;crt&lt;/code&gt;
lets you override this.
For instance, on one machine,
I set this 120 lines
and commonly read my 3–4 system messages
by issuing
&lt;kbd&gt;p *&lt;/kbd&gt;
to display all the messages.
Any one message falls below that threshold,
letting me see an individual message without paging.
But I find it handy to read all of them together in
&lt;code&gt;$PAGER&lt;/code&gt;
in one quick skim.
&lt;/dd&gt;

&lt;dt id="setting-folder"&gt;&lt;code&gt;folder&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
By default,
&lt;code&gt;mail&lt;/code&gt;
assumes all your mail-folders
reside in your
&lt;code&gt;$HOME&lt;/code&gt;
directory.
If you use the
&lt;kbd&gt;folders&lt;/kbd&gt;
command to list available mbox files,
it may return lots of non-mbox files.
Instead, if you store your mail in a subdirectory,
you can set that here.
Additionally, regardless of your current working-directory,
you can prefix folder-names with a "+"
to refer to folders in your
&lt;code&gt;folder&lt;/code&gt;
directory
&lt;/dd&gt;

&lt;dt id="setting-header"&gt;&lt;code&gt;header&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
Each time you open a folder
(whether at startup
or using the
&lt;kbd&gt;file&lt;/kbd&gt;
command),
&lt;code&gt;mail&lt;/code&gt;
displays a screen-full of headers.
If you don't want this behavior,
set
&lt;code&gt;noheader&lt;/code&gt;.
&lt;/dd&gt;

&lt;dt id="setting-hold"&gt;&lt;code&gt;hold&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
When quitting and leaving your system mailbox,
by default
&lt;code&gt;mail&lt;/code&gt;
will move every read-message
into your
&lt;a href="https://blog.thechases.com/posts/using-mail/#setting-mbox"&gt;&lt;code&gt;MBOX&lt;/code&gt;&lt;/a&gt;
store
(&lt;code&gt;~/mbox&lt;/code&gt;
by default).
By setting
&lt;code&gt;hold&lt;/code&gt;,
&lt;code&gt;mail&lt;/code&gt;
will leave messages in your system mail-store
until you manually
&lt;a href="https://blog.thechases.com/posts/using-mail/#read-save"&gt;move&lt;/a&gt;
or
&lt;a href="https://blog.thechases.com/posts/using-mail/#read-delete"&gt;delete&lt;/a&gt;
them.
&lt;/dd&gt;

&lt;dt id="setting-indentprefix"&gt;&lt;code&gt;indentprefix&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
When
&lt;a href="https://blog.thechases.com/posts/using-mail/#tilde-m"&gt;replying to a message&lt;/a&gt;,
common convention suggests
that you prefix each quoted line with the string
"&amp;gt; "
The
&lt;code&gt;indentprefix&lt;/code&gt;
setting controls this.
&lt;/dd&gt;

&lt;dt id="setting-mbox"&gt;&lt;code&gt;MBOX&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
This specifies your default "mbox"
local mail store,
defaulting to
&lt;code&gt;~/mbox&lt;/code&gt;
but I prefer to set this to
a file within my
&lt;code&gt;~/mail&lt;/code&gt;
hierarchy
&lt;/dd&gt;

&lt;dt id="setting-record"&gt;&lt;code&gt;record&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
When sending a message,
often times you want to keep that message around.
The
&lt;code&gt;record&lt;/code&gt;
setting lets you specify the folder in which to put a copy.
Unfortunately, there's no folder-name for the current folder,
but you can use something like
&lt;code&gt;+sent&lt;/code&gt;
to keep them all in the same folder.
&lt;/dd&gt;

&lt;dt id="setting-searchheaders"&gt;&lt;code&gt;searchheaders&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;
Normally when specifying a message-list
by searching with
&lt;kbd&gt;/&lt;/kbd&gt;,
&lt;code&gt;mail&lt;/code&gt;
will only search the Subject header.
However, if you enable
&lt;code&gt;searchheaders&lt;/code&gt;,
you can prefix your search term with a header-name to search.
This lets you do things like
&lt;kbd&gt;f /To:&lt;var&gt;dean@example.edu&lt;/var&gt;&lt;/kbd&gt;
(to search for all messages sent to the dean)
or
&lt;kbd&gt;f /Date:&lt;var&gt;Jul&lt;/var&gt;&lt;/kbd&gt;
(to search for messages sent in July).
If you omit the header,
it defaults to searching the Subject header as usual.
&lt;/dd&gt;

&lt;/dl&gt;

&lt;p&gt;
As promised,
an excerpt of my
&lt;code&gt;~/.mailrc&lt;/code&gt;
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;&lt;kbd&gt;cat ~/.mailrc&lt;/kbd&gt;
# I prefer to keep my mbox files 
# in a mail/ subdirectory
# to keep from cluttering my
# home directory.
set folder=mail
set MBOX=+inbox
set record=+sent
set hold
set searchheaders
set indentprefix="&amp;gt; "
set crt=120
retain cc
retain date
retain subject
source ~/aliases
&lt;/pre&gt;
&lt;figcaption&gt;My ~/.mailrc file&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id="tips"&gt;Tips &amp;amp; tricks&lt;/h2&gt;

&lt;h3 id="tip-delete-undelete"&gt;Deleting all-but XYZ&lt;/h3&gt;

&lt;p&gt;
I receive a number of messages from system-administration processes.
Some come daily,
some weekly,
some monthly.
Some have security advisories,
while others give general system information.
So I usually want to delete the non-security-related ones.
However, the subject lines make this more challenging.
The trick?
Delete all of them,
then undelete the security-related ones:
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;d &lt;var&gt;root@myhost.example.com&lt;/var&gt;&lt;/kbd&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;u &lt;var&gt;/insecurity&lt;/var&gt;&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;deleting all system messages, then undeleting security-related ones&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
I can then review these more-relevant messages
without the noise of the other messages.
&lt;/p&gt;

&lt;h3 id="tip-read-fast"&gt;Quickly processing messages&lt;/h3&gt;

&lt;p&gt;
On some machines,
I want to read all the mail in my
&lt;code&gt;$PAGER&lt;/code&gt;
pressing
&lt;kbd&gt;space&lt;/kbd&gt;
to show a screen-full at a time
and then delete all the messages unless
something surprising shows up.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;p *&lt;/kbd&gt;
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;d *&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;displaying all messages, then deleting them&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Other times,
I want to read each message
and process as I go.
After displaying a message,
I can hit enter
(with no command)
to display the next message automatically.
Alternatively, the
&lt;kbd&gt;dp&lt;/kbd&gt;
command will delete the current message
and print the next message in one go.
It may only save one keypress,
but I find it useful
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;1&lt;/kbd&gt;
Message 1:
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;
Message 2:
&lt;label class="visual"&gt;⋮&lt;/label&gt;
&lt;label class="user"&gt;&amp;amp; &lt;/label&gt;&lt;kbd&gt;dp&lt;/kbd&gt;
&lt;/pre&gt;
&lt;figcaption&gt;displaying sequential messages; deleting and displaying in one command&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!-- notes:

"reply" = reply all
"Reply" = reply to sender only

--&gt;</description><category>ed</category><category>mail</category><guid>https://blog.thechases.com/posts/using-mail/</guid><pubDate>Wed, 14 Dec 2022 17:05:34 GMT</pubDate></item></channel></rss>