MAIL(1)
π NAME π
okay bestie, welcome to MAIL(1) β the mail page from User Contributed Perl Documentation β and it is literally an implementation of Berkeley mail(1). π no cap, that's the whole main-character intro.
β¨ SYNOPSIS β¨
run it like this, bestie:
mail [-f mailbox]
mail [-s subject] [-c cc-addrs] [-b bcc-addrs] to-addr [..toaddr..]
πΈ DESCRIPTION πΈ
When called without command-line options (except -f), mail lets you interactively send mail and manage a mail folder. Otherwise, mail lets you send outgoing E-mail to recipients. π
When run interactively, the mail folder ~/mbox is used. If the home directory cannot be determined, ./mbox is assumed. This can be overridden with the -f option. π«Ά
π OPTIONS π
mail accepts the following options:
-f mailboxβ specifies a mail folder to use.-s subjectβ specify a subject for the mail message.-c cc-addrsβ a comma-separated list of addresses to be copied to on the mail message.-b bcc-addrsβ a comma-separated list of addresses to be copied to on the mail message, without appearing in the headers.to-addrβ E-Mail destination addresses. You may not be notified if mail fails to deliver to the address properly. π
π₯ COMMANDS π₯
In the list below, msg indicates a message list. Acceptable values are comma or space separated lists, ranges (i.e. 1-5) or single digits. Special values are $ (end of list) and * (all messages). If messages are unspecified, the current message is used. path indicates a filename argument. addr indicates a mail message address list (comma or space separated).
numberβ read message number.!commandβ execute thecommandwith the command interpreter.copy msg pathβ copy indicated messages (msg) to filename atpath.cois an alias for this command.delete msgβ delete indicated messages.dis an alias for this command.exitβ exit the mail program saving no changes to the mailbox.xis an alias for this command.from msgβ display the headers from the specified messages.fis an alias for this command.headers msgβ display a brief list of headers from the messages.his an alias for this command.hold msgβ mark messages as unread.ho,preserveare aliases for this command.mail addrβ send a mail message toaddr.mis an alias for this command.nextβ print the next message in sequence.nis an alias for this command.print msgβ print the specified mail message.p,CRare aliases for this command.quitβ exit the mail program. The (possibly) edited mailbox is re-written to its original file. See Bugs.qis an alias for this command.reply msgβ reply to the original sender ofmsg.ris an alias for this command.Reply msgβ reply to the original sender, and all visible recipients ofmsg.Ris an alias for this command.save msg pathβ savemsginto the file specified atpath. If the file exists, it is appended.sis an alias for this command.shellβ start an interactive bourne shell. (This does not work under Win32).shis an alias for this command.topβ display the first few lines of the current mail message.undelete msgβ mark as undeleted any specified mail messages.uis an alias for this command.unread msgβ mark as unread any specified mail messages.Uis an alias for this command.visual msgβ invoke the visual editor (specified in$VISUAL, or/usr/bin/vi) on the indicated messages. Re-read those messages in after the editing session.vis an alias for this command.write msg pathβ write the bodies of the indicated messages topath.wis an alias for this command.
π¦ EDITING COMMANDS π¦
When sending a mail message (commands mail, reply or Reply) a primitive line-mode editor is used to get the body of the mail message, and possibly change any header options. During the editing session, special commands may be used when typed at the beginning of the line. π
To send the message, send an EOF character or a . on a line by itself.
~ssubjectβ change message subject to subject.~qβ quit the message editor. No changes are made, no message is sent.~caddr[,addr...]β add the addrs to the CC list for the message.~baddr[,addr...]β add the addrs to the BCC list for the message.~taddr[,addr...]β add the addrs to the To: list for the message.~mmsgβ read the specified messages into the current message at the end.~fmsgβ read the specified messages into the current message at the end, indenting each line with the sequence"> ".~rfileβ read the contents of file into the message.~vβ invoke the visual editor on the message. When the user is done editing the message, read the message back in, and continue editing at the end.
π BUGS π
Numerous. Mostly lack of refinement in the implementation, any of which can be fixed without hassle, I'm sure.
- Many (many, many..) features left unimplemented. Command-line, commands and editing functions have all been decimated. I only implemented what I thought was useful. BSD
mailhad many years to develop its many tentacles. I don't have that kind of patience. - Keeping track of the "current" message in the mail folder is sloppy.
- Screen length is assumed to be 23 characters. Width is 79.
- Argument parsing doesn't ensure sane (and legal) combinations.
- There is no file locking. Of anything. You wanna re-write the mailbox and there's local delivery going on? Fine. Have fun.
mailwill refuse to write back a mailbox whose size has changed however... maildoesn't act as a Local Delivery Agent.mail's method of picking through mail message headers to find from, to and cc addresses violates several FAQ's, RFC's, and is void where prohibited. Also easy to fix, I simply ran out of patience. See the_extractmethod in the message class if you're adventuresome.- To perform delivery,
mailsearches for$USERor$LOGNAMEin your environment to see who you are (for a From address). It then searches for an SMTP agent onlocalhost. Not finding that, it wants$RELAYHOSTset to your SMTP relaying host name. Your reply address is taken from$REPLYADDRor your system's environment. Whichever is easier. Win32 systems, be prepared to setup your environment properly for this to work! - ...speaking of SMTP...
mailtalks directly to SMTP instead of using a more sane method likeMail::Mailer. This was done so thatPPT mail(1)could remain "pure" and un-encumbered by external modules.
π AUTHOR π
The Perl implementation of mail was written by Clinton Pierce, clintp@geeksalad.org.
π COPYRIGHT and LICENSE π
This program is Copyright 1999, by Clinton Pierce.
Freely redistributable under the Perl Artistic License.
okay bestie, that's the whole page β this was MAIL(1), from perl v5.42.2, dated 2026-02-15. mwah πβ¨
π¦ where this page comes from
- alpine 3.24: perl-power-tools-doc 1.053-r1 Β· GPL-2.0-or-later AND Artistic-1.0-Perl AND Artistic-2.0 AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms