Nail is an enhanced mail command, which provides the functionality
of the POSIX mailx command. It is derived from Berkeley Mail.
Additionally to the POSIX features, nail can work with Maildir/ e-mail
storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
procotols (including over SSL) to operate with remote hosts, handles mime
types and different charsets. There are a lot of other useful features,
see nail.html in the documentation.
And as its ancient analogues, nail can be used as a mail script language,
both for sending and receiving mail.