[AIX 네트워크 관리 4] 메일 (3) 도움말, .mailrc 사용자 정의, mail 하위 명령

핵심 정리

  • 도움말: 메일함 프롬프트에서 ?나 help(전체 목록은 l), mail 편집기에서 ~?, 비밀 메일에서 ?, 명령줄에서 man mail.
  • mail 설정은 시스템 공통 /usr/share/lib/Mail.rc와 개인 $HOME/.mailrc에 두며, .mailrc가 우선합니다. 옵션은 켜고 끄는 이진 옵션과 값을 주는 옵션이 있고, unset 옵션은 set no옵션과 같습니다.
  • 자주 쓰는 옵션: set ask/askcc(제목·Cc 묻기), alias 이름 주소…(별칭·배포 목록), set screen=20(목록 줄 수), set crt=20(긴 메시지는 pg로), set toplines=10(top 하위 명령 줄 수), ignore 필드…·retain(머리글 숨기기·되돌리기), set quiet/noheader(배너 숨기기), set autoprint(d 뒤 다음 메시지 표시), set folder=·set record=(폴더·보낸 메일 기록), set EDITOR=·VISUAL=.
  • 메일함 프롬프트는 &, 비밀 메일함 프롬프트는 ?이며, mail 편집기 하위 명령은 모두 ~로 시작합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (내용이 같음)
원문 Networks and communication management — 5.3판 3344쪽, 6.1판 3445쪽
파일 $HOME/.mailrc, /usr/share/lib/Mail.rc
관련 명령어 mail, xsend, xget, pg, man

메일 도움말 정보

?, man, info 명령으로 mail 프로그램 사용법에 관한 도움말을 얻을 수 있습니다.

어디서 방법
메일함 메일함 프롬프트에서 ?나 help를 입력합니다. 자주 쓰는 메일함 하위 명령의 요약을 보여 줍니다. l(list) 하위 명령을 입력하면 모든 메일함 하위 명령의 목록(요약 없이)을 보여 줍니다.
mail 편집기 mail 편집기 프롬프트에서 ~?를 입력합니다. 자주 쓰는 mail 편집기 하위 명령의 요약을 보여 줍니다.
비밀 메일 프롬프트에서 ?를 입력합니다. 자주 쓰는 비밀 메일 하위 명령의 요약을 보여 줍니다.
매뉴얼 페이지 시스템 명령줄 프롬프트에서 man mail을 입력합니다. 이 예에서 찾는 명령 이름은 mail이며, mail 명령에 관한 ASCII 문서가 나옵니다. 계속 표시(:)에서 Enter를 누르면 나머지 문서를 봅니다. man 명령은 명령, 서브루틴, 파일의 참조 주제를 ASCII 형식으로 보여 줍니다.
영어 원문

Mail help information

You can obtain help information on using the mail program by using the ?, man, or info commands.

  • To get help in the Mailbox — Enter ? or help at the mailbox prompt. The ? and help subcommands display a summary of common mailbox subcommands. You can display a list of all mailbox subcommands (with no summary) by entering the (l)ist subcommand.

To get help in the Mail Editor Type ~? at the mail editor prompt.

The ~? subcommand displays a summary of common mail editor subcommands.

To get help in secret mail Type ? at the mail editor prompt.

The ? subcommand displays a summary of common secret mail subcommands.

To get help using manual pages Type man mail at the system command line prompt.

In this example, mail is the command name being searched. The system will provide you with ASCII documentation about the mail command. At the continuation marker (:), press Enter to view the rest of the document.

The man command provides information in ASCII form for reference topics on commands, subroutines, and files.

mail 프로그램 사용자 정의 옵션

.mailrc와 /usr/share/lib/Mail.rc 파일의 명령과 옵션을 고쳐 메일 사용 방식에 맞출 수 있습니다.

mail 옵션은 아래 "mail 옵션 켜기와 끄기"를 봅니다.

메일 세션에서 바꿀 수 있는 특성은 다음과 같습니다.

  • 메시지 제목 묻기: mail 명령을 입력하면 Subject: 필드를 채우라고 묻습니다. 이때 메시지 주제의 요약을 적으면 받는 사람이 읽을 때 메시지 맨 앞에 들어갑니다. Subject:와 Cc: 필드 묻기를 봅니다.
  • 사본 받을 사용자 묻기: .mailrc 파일을 고쳐 메시지를 보낼 때 사본을 받을 다른 사용자의 이름을 묻게 할 수 있습니다. Subject:와 Cc: 필드 묻기를 봅니다.
  • 별칭이나 배포 목록: 큰 네트워크에서 메일을 보내거나 같은 메시지를 많은 사람에게 자주 보내면, 받는 사람마다 긴 주소를 입력하기가 번거롭습니다. .mailrc 파일에 별칭이나 배포 목록을 만들면 간단해집니다. 별칭은 사용자 주소 하나 대신 쓰는 이름이고, 배포 목록은 사용자 주소 묶음 대신 쓰는 이름입니다. 별칭과 배포 목록을 봅니다.
  • 메시지를 읽을 때 표시하는 줄 수: 화면에서 넘어가는 메시지 머리글이나 메시지 본문의 줄 수를 바꿀 수 있습니다. 메시지 머리글·본문 표시 줄 수 바꾸기를 봅니다.
  • 메시지에 나오는 정보: 기계가 설정하는 message-id 필드 같은 메시지 머리글을 끌 수 있습니다. 메시지에 정보 표시하기를 봅니다.
  • 메시지를 저장할 폴더 디렉터리: 메시지를 저장할 특별한 디렉터리를 만들 수 있습니다. 메시지를 저장하거나 폴더를 볼 때 더하기(+) 약식 표기로 그 디렉터리를 가리킬 수 있습니다. 메시지를 저장할 기본 폴더 만들기를 봅니다.
  • 보낸 메시지를 기록하는 로그 파일: 보내는 모든 메시지를 홈 디렉터리의 파일이나 하위 디렉터리에 기록하게 할 수 있습니다. 메시지를 저장할 기본 폴더 만들기를 봅니다.
  • 메시지를 입력할 편집기: mail 편집기 말고도 메시지를 편집할 편집기 두 가지를 고를 수 있습니다. 메시지 입력용 텍스트 편집기를 봅니다.

mail 프로그램 사용자 정의에 관한 자세한 내용은 다음 주제를 봅니다.

mail 옵션 켜기와 끄기

옵션은 이진(binary) 옵션이거나 값(valued) 옵션입니다. 이진 옵션은 설정하거나 해제하고, 값 옵션은 특정 값으로 설정합니다.

참고: unset option 형식은 set nooption과 같습니다.

pg 명령으로 /usr/share/lib/Mail.rc 파일을 볼 수 있습니다. 이 파일의 내용이 mail 프로그램의 구성을 정합니다. $HOME/.mailrc 파일을 만들어 mail 프로그램의 시스템 구성을 바꿉니다. mail 명령을 실행하면 .mailrc 파일의 하위 명령이 /usr/share/lib/Mail.rc 파일의 비슷한 하위 명령보다 우선합니다. .mailrc 옵션은 사용자에 맞게 고칠 수 있고 mail 프로그램을 쓸 때마다 적용됩니다.

파일에 저장된 mail 명령을 실행하려면 source 하위 명령을 씁니다.

전제 조건: mail 프로그램이 시스템에 설치되어 있어야 합니다.

mail 옵션 켜기

메일 세션의 특성을 바꾸는 데 가장 많이 쓰는 메일함 하위 명령입니다.

하위 명령 설명
set mail 옵션을 켭니다.
source 파일에 저장된 mail 옵션을 켭니다. 메일을 읽는 중에 메일함 프롬프트에서 source PathName을 입력합니다. PathName은 mail 명령이 든 파일의 경로입니다. 이 파일의 명령은 현재 세션 동안 비슷한 명령의 이전 설정보다 우선합니다. 메일함 프롬프트에 명령을 입력해 현재 메일 세션의 특성을 바꿀 수도 있습니다.

이 옵션은 메일함 안에서 설정하거나 .mailrc 파일에 항목을 넣어 설정할 수 있습니다.

켜진 mail 옵션 보기

메일을 읽는 중에 인수 없이 set 하위 명령을 입력하면 켜진 .mailrc 옵션이 모두 나옵니다. 이 목록에서 폴더 디렉터리가 골라져 있는지, 보낸 메시지를 기록할 로그 파일이 설정되어 있는지도 볼 수 있습니다.

메일함 프롬프트에서 다음을 입력합니다.

text
set

다음과 비슷한 결과가 나옵니다.

text
ask
metoo
toplines 10

이 예에서는 이진 옵션 ask와 metoo가 켜져 있습니다. 목록에 askcc 항목이 없으므로 askcc 옵션은 꺼져 있습니다. toplines 옵션에는 값 10이 주어졌습니다. ask, metoo, askcc, toplines 옵션은 Files Reference의 .mailrc File Format 절에 설명되어 있습니다.

mail 옵션 끄기

메일 세션의 특성을 바꾸는 데 가장 많이 쓰는 메일함 하위 명령입니다.

하위 명령 설명
unset mail 옵션을 끕니다.
unalias 지정한 별칭 이름을 지웁니다.
ignore 메시지 머리글 필드를 숨깁니다.

이 옵션은 메일함 안에서 설정하거나 .mailrc 파일에 항목을 넣어 설정할 수 있습니다.

참고: unset option 형식은 set nooption과 같습니다.

Subject:와 Cc: 필드 묻기

전제 조건: mail 프로그램이 시스템에 설치되어 있어야 합니다.

Subject: 필드 묻기 켜고 끄기

set과 unset 명령으로 Subject: 필드 묻기를 켜고 끕니다.

하위 명령 설명
set ask .mailrc 파일의 ask 옵션으로 Subject: 필드 묻기를 켭니다.
unset ask .mailrc 파일의 ask 옵션으로 Subject: 필드 묻기를 끕니다.

Cc: 필드 묻기 켜고 끄기

set과 unset 명령으로 Cc: 필드 묻기를 켜고 끕니다.

하위 명령 설명
set askcc .mailrc 파일의 askcc 옵션으로 Cc: 필드 묻기를 켭니다.
unset askcc .mailrc 파일의 askcc 옵션으로 Cc: 필드 묻기를 끕니다.

별칭과 배포 목록

별칭과 배포 목록을 만들면 자주 쓰는 받는 사람과 주소를 더 쉽게 관리할 수 있습니다.

별칭이나 배포 목록을 만들기 전에 다음 조건을 확인합니다.

  1. mail 프로그램이 시스템에 설치되어 있어야 합니다.
  2. 별칭이나 배포 목록에 넣을 사용자의 이름과 주소를 알아야 합니다.

별칭이나 배포 목록은 다음처럼 만듭니다.

항목 설명
alias kath kathleen@gtwn 별칭 kath를 주소 gtwn의 사용자 kathleen으로 정합니다. 이 줄을 $HOME/.mailrc 파일에 넣은 뒤 명령줄에서 mail kath를 입력하면 Kathleen에게 메시지를 보낼 수 있습니다.
alias dept dee@merlin anne@anchor jerry@zeus bill carl 이 줄을 $HOME/.mailrc 파일에 넣은 뒤 명령줄에서 mail dept를 입력하면 부서 전체에 메시지를 보낼 수 있습니다. 만들어 보낸 메시지는 merlin 시스템의 dee, anchor 시스템의 anne, zeus 시스템의 jerry, 로컬 시스템의 bill과 carl에게 갑니다.

별칭과 배포 목록을 보려면 메일함 프롬프트에서 alias나 다음을 입력합니다.

text
a

별칭과 배포 목록의 목록이 나옵니다.

메시지 머리글·본문 표시 줄 수 바꾸기

.mailrc 파일을 고쳐 메일함 목록이나 실제 메시지를 넘겨 보는 방식을 바꿀 수 있습니다. 이렇게 하려면 mail 프로그램이 시스템에 설치되어 있어야 합니다.

메시지 목록의 표시 줄 수 바꾸기

메일함의 메시지마다 메시지 목록에 한 줄짜리 머리글이 있습니다. 메시지가 24개를 넘으면 목록의 첫 머리글들이 화면 위로 넘어갑니다. set screen 옵션이 목록을 한 번에 몇 줄 표시할지 정합니다.

한 번에 표시하는 메시지 목록의 줄 수를 바꾸려면 $HOME/.mailrc 파일에 다음을 입력합니다.

text
set screen=20

이 예에서는 메시지 머리글을 한 번에 20개 표시합니다. 머리글을 더 보려면 h나 z 하위 명령을 씁니다. 이 하위 명령은 메일함 프롬프트에 입력할 수도 있습니다.

긴 메시지의 표시 줄 수 바꾸기

24줄이 넘는 메시지를 표시하면 메시지의 첫 줄들이 화면 위로 넘어갑니다. .mailrc 파일에 set crt 옵션을 넣어 두면 mail 안에서 pg 명령으로 긴 메시지를 넘겨 볼 수 있습니다.

set crt 옵션은 메시지가 몇 줄 이상이어야 pg 명령을 시작할지 정합니다.

예를 들어 t 하위 명령으로 긴 메시지를 읽으면 한 화면(페이지)만 나옵니다. 페이지 뒤에는 쪽이 더 있음을 알리는 콜론 프롬프트가 나옵니다. Enter 키를 누르면 다음 페이지가 나옵니다. 마지막 페이지가 나오면 다음과 비슷한 프롬프트가 나옵니다.

text
EOF:

이 프롬프트에서 올바른 pg 하위 명령을 입력할 수 있습니다. 이전 페이지를 보거나, 메시지에서 문자열을 찾거나, 메시지 읽기를 끝내고 메일함 프롬프트로 돌아갈 수 있습니다.

set crt 옵션은 .mailrc 파일에 set crt=Lines 형식으로 넣습니다. 예:

text
set crt=20

이렇게 하면 메시지가 20줄이어야 pg 명령이 시작됩니다. 20줄이 넘는 메시지를 읽을 때 pg 명령이 시작됩니다.

메시지 맨 위의 표시 줄 수 바꾸기

top 하위 명령은 메시지 전체를 읽지 않고 훑어보게 합니다. 표시할 줄 수는 다음처럼 toplines 옵션으로 정합니다.

text
set toplines= Lines

Lines 변수는 top 하위 명령으로 표시할, 맨 위부터 모든 머리글 필드를 포함한 줄 수입니다.

예를 들어 사용자 Amy의 .mailrc 파일에 다음 줄이 있으면

text
set toplines=10

Amy가 mail 명령으로 새 메시지를 읽을 때 다음이 나옵니다.

text
Mail Type ? for help.
"/usr/mail/amy": 2 messages 2 new>
N 1 george  Wed Jan 6 9:47  11/257 "Dept Meeting"
N 2 mark    Wed Jan 6 12:59 17/445 "Project Planner"

Amy가 top 하위 명령으로 메시지를 훑어보면 다음처럼 메시지 일부가 나옵니다.

text
top 1
Message 1:
From george Wed Jan 6 9:47 CST 1988
Received: by zeus
    id AA00549; Wed, 6 Jan 88 9:47:46 CST
Date: Wed, 6 Jan 88 9:47:46 CST
From: george@zeus
Message-Id: <8709111757.AA00178>
To: amy@zeus
Subject: Dept Meeting
Please plan to attend the department meeting on Friday
at 1:30 in the planning conference room. We will be

toplines가 10으로 설정되어 있으므로 메시지의 일부만 나옵니다. 1행(Received: 필드)부터 10행(메시지 본문의 둘째 줄)까지만 나옵니다. 첫 줄 From george Wed Jan 6 9:47 CST 1988은 늘 나오며 toplines 옵션의 줄 수에 들어가지 않습니다.

메시지에 정보 표시하기

.mailrc 파일을 고쳐 메시지에 어떤 머리글 정보를 표시할지 정할 수 있습니다.

어떤 머리글 정보는 이미 꺼져 있을 수 있습니다. /usr/share/lib/Mail.rc 파일에서 무시하는 머리글 필드를 확인합니다.

전제 조건: mail 프로그램이 시스템에 설치되어 있어야 합니다.

Date, From, To 머리글을 표시하지 않기

메시지마다 맨 위에 머리글 필드가 여럿 있으며, 메시지를 읽을 때 표시됩니다. ignore 하위 명령으로 메시지를 읽을 때 머리글 필드를 숨길 수 있습니다. 형식은 다음과 같습니다.

text
ignore [ FieldList ]

FieldList는 메시지를 표시할 때 무시할 필드 이름 하나 이상입니다. 예를 들어 사용자 Amy의 .mailrc 파일에 다음 줄이 있고

text
ignore date from to

/usr/share/lib/Mail.rc 파일에 다음 줄이 있으면

text
ignore received message-id

t 하위 명령의 결과는 다음과 같습니다.

text
t 1
Message 1:
From george Wed Jan 6 9:47 CST 1988
Subject: Dept Meeting
Please plan to attend the department meeting on Friday
at 1:30 in the planning conference room. We will be
discussing the new procedures for using the project
planning program developed by our department.

Received:, Date:, From:, Message-Id:, To: 필드가 표시되지 않습니다. 이 필드들을 표시하려면 T나 P 하위 명령이나 top 하위 명령을 씁니다.

참고: 예에서 From 줄은 표시됩니다. 이 줄은 ignore 하위 명령의 FieldList에 넣은 From: 필드와 다릅니다.

무시하는 머리글 필드 보기

현재 무시하는 머리글 필드 목록을 보려면 메일함 프롬프트에서 다음을 입력합니다.

text
ignore

현재 무시하는 머리글이 모두 나옵니다. 예:

text
mail-from
message-id
return-path

머리글 필드 되돌리기

머리글 필드를 되돌리려면 retain 하위 명령을 씁니다. 예:

text
retain date

유지하는 머리글 필드 보기

현재 유지하는 머리글 필드를 보려면 머리글 필드 매개변수 없이 retain 하위 명령을 입력합니다.

배너를 표시하지 않기

mail 배너는 mail 명령을 입력했을 때 메시지 목록 맨 위에 mail 프로그램의 이름을 보여 주는 줄입니다. 다음과 비슷합니다.

text
Mail [5.2 UCB] [Workstation 3.1] Type ? for help.

mail 프로그램을 시작할 때 배너를 표시하지 않으려면 $HOME/.mailrc 파일에 다음 줄을 넣습니다.

text
set quiet

mail 배너를 숨기는 다른 옵션은 다음과 같습니다.

text
set noheader

이 옵션이 .mailrc 파일에 있으면 메일함의 메시지 목록이 표시되지 않습니다. mail 프로그램을 시작하면 메일함 프롬프트만 나옵니다. h(header) 하위 명령을 입력하면 메시지 목록을 볼 수 있습니다.

삭제와 표시 명령 합치기

autoprint 옵션으로 삭제와 표시 하위 명령을 합칩니다.

메시지를 읽은 뒤 d 하위 명령으로 지울 수 있고, p 하위 명령으로 다음 메시지를 표시할 수 있습니다. .mailrc 파일에 다음 줄을 넣어 이 둘을 합칩니다.

text
set autoprint

.mailrc 파일에 set autoprint 옵션이 있으면 d 하위 명령이 현재 메시지를 지우고 다음 메시지를 표시합니다.

메시지를 저장할 기본 폴더 만들기

기본 폴더에 메시지를 저장할 수 있습니다. mail 프로그램이 시스템에 설치되어 있어야 합니다.

폴더에 메시지를 저장할 letters 메일함 디렉터리를 만드는 절차입니다.

  1. .mailrc 파일에 set folder 옵션이 켜져 있는지 확인하려면 메일함 프롬프트에서 다음을 입력합니다.
text
set

set folder 옵션이 켜져 있으면 다음이 나옵니다.

text
folder /home/george/letters

이 예에서 letters가 메일 폴더를 저장할 디렉터리입니다.

  1. set folder 옵션이 켜져 있지 않으면 .mailrc 파일에 set folder 항목을 넣습니다.
text
set folder=/home/george/letters

이 예에서 /home/george는 George의 홈 디렉터리이고 letters는 메일 폴더를 저장할 디렉터리입니다. set folder 옵션을 쓰면 더하기(+) 약식 표기로 letters 디렉터리에 메시지를 저장할 수 있습니다.

  1. letters 디렉터리가 없으면 홈 디렉터리에 만들어야 합니다. 홈 디렉터리의 시스템 명령줄에서 다음을 입력합니다.
text
mkdir letters

다른 사람에게 보낸 메시지를 기록해 두는 절차입니다.

  1. .mailrc 파일에 다음 문을 넣습니다.
text
set record=letters/mailout
  1. letters 디렉터리가 없으면 홈 디렉터리에 만들어야 합니다. 홈 디렉터리의 시스템 명령줄에서 다음을 입력합니다.
text
mkdir letters
  1. 다른 사람에게 보낸 메시지의 사본을 읽으려면 다음을 입력합니다.
text
mail -f +mailout

이 예에서 mailout 파일에는 다른 사람에게 보낸 메시지의 사본이 들어 있습니다.

메시지 입력용 텍스트 편집기

set EDITOR=PathName 옵션으로 메시지를 입력할 텍스트 편집기를 정합니다. mail 프로그램이 시스템에 설치되어 있어야 합니다.

옵션 설명
set EDITOR=PathName .mailrc 파일의 이 옵션은 ~e로 시작할 편집기를 정합니다. PathName은 쓰려는 편집기 프로그램의 전체 경로 이름이어야 합니다. mail 프로그램에서 e 편집기로 바꾸려면 ~e를 입력합니다. e 편집기나 .mailrc에 정의한 다른 편집기가 시작되며, 그 편집기로 메일 메시지를 편집합니다.
set VISUAL=PathName .mailrc 파일의 이 옵션은 ~v로 시작할 편집기를 정합니다. PathName은 쓰려는 편집기 프로그램의 전체 경로 이름이어야 하며, 기본값은 /usr/bin/vi입니다. mail 프로그램에서 vi 편집기로 바꾸려면 ~v를 입력합니다. vi 편집기나 .mailrc에 정의한 다른 편집기가 시작되며, 그 편집기로 메일 메시지를 편집합니다.
영어 원문

Mail program customization options

Commands and options in the .mailrc and /usr/share/lib/Mail.rc files can be customized to fit your personal mailing needs.

See “Mail enabling and disabling options” for information about mail options.

Characteristics of a mail session that you can customize include:

  • Prompts for the subject of a message. When you enter the mail command, the program asks you to complete a Subject: field. When this prompt is displayed, you can fill in a summary of the subject matter of the message. That summary is included at the start of the message when it is read by the recipient. See Subject: and Carbon Copy (Cc:) field prompts.

  • Prompts for users to get a copy of a message. You can customize the .mailrc file so that when you send a message, the mail program prompts you for the names of other users who should receive copies of the message. See Subject: and Carbon Copy (Cc:) field prompts.

  • Aliases or distribution lists. If you send mail on a large network or often send the same message to a large number of people, typing long addresses for each receiver can become tedious. To simplify this process, create an alias or a distribution list in your .mailrc file. An alias is a name you define that can be used in place of a single user address. A distribution list is a name you define that can be used in place of a group of user addresses. See Aliases and distribution lists.

  • Number of lines displayed when reading messages. You can change the number of lines of message headers or of message text that scroll across the screen. See Changes to the number of message headers or message text lines displayed in the mail program.

  • Information listed in messages. You can turn off message headers, such as the machine-set message-id field. See Displaying information in a message.

  • Folder directory for storing messages. You can create a special directory for storing messages. You can use the shorthand plus sign (+) subcommand to designate that directory when storing messages or looking at folders. See Creating default folders to store messages.

  • Log file for recording outgoing messages. You can instruct the mail program to record all your outgoing messages in a file or a subdirectory in your home directory. See Creating default folders to store messages.

  • Editors for typing messages. In addition to the mail editor, you can choose two different editors to edit messages. See Text editors for typing messages.

For more information on customizing the mail program, see the following topics.

Mail enabling and disabling options

Options can be either binary or valued.

Binary options are either set or unset, while valued options can be set to a specific value.

Note: The form unset option is equivalent to set no option.

Use the pg command to view the /usr/share/lib/Mail.rc file. The contents of the /usr/share/lib/ Mail.rc file define the configuration of the mail program. Alter the system configuration for your mail program by creating a $HOME/.mailrc file. When you run the mail command, subcommands in the .mailrc file override similar subcommands in the /usr/share/lib/Mail.rc file. The .mailrc options can be customized and are valid each time you use the mail program.

To execute mail commands that are stored in a file, use the source subcommand.

text
Prerequisites

The mail program must be installed on your system.

Enabling mail options:

These mailbox subcommands are most commonly used to alter the characteristics of a mail session.

  • set — Enables mail options.
  • source — Enables mail options that are stored in a file. When reading mail, you can issue this subcommand at the mailbox prompt: source PathName where PathName is the path and file containing the mail commands. Commands in this file override the previous settings of any similar commands for the duration of the current session. You can also alter the characteristics of the current mail session by typing commands at the mailbox prompt.

You can set these options while in the mailbox or by making entries in the .mailrc file.

Viewing enabled mail options:

When reading your mail, enter the set subcommand without any arguments to list all of the enabled .mailrc options.

In this list, you can also see if a folder directory is selected and if a log file is set up to record outgoing messages.

At the mailbox prompt, type:

text
set

A message similar to the following is displayed:

text
ask
metoo
toplines 10

In this example, two binary options are enabled: ask and metoo. There is no askcc entry in the list. This indicates that the askcc option is not enabled. The toplines option has been assigned the value 10. The ask, metoo, askcc, and toplines options are described in .mailrc File Format section of the Files Reference.

Disabling mail options:

These mailbox subcommands are most commonly used to alter the characteristics of a mail session.

  • unset — Disables mail options.
  • unalias — Deletes the specified alias names.
  • ignore — Suppresses message header fields.

You can set these options while in the mailbox or by making entries in the .mailrc file.

Note: The form unset option is equivalent to set no option.

Subject: and Carbon Copy (Cc:) field prompts

When the Subject: and Cc: field prompts are edited, the following prerequisite must be met.

text
Prerequisites

The mail program must be installed on your system.

Enabling or disabling Subject: field prompting:

Use the set and unset commands to enable and disable the Subject: field.

You can enable or disable the Subject: field in the way shown in the following examples:

  • set ask — Subject: field prompting is enabled by editing the .mailrc file ask option.
  • unset ask — Subject: field prompting is disabled by editing the .mailrc file ask option.
  • Enabling or disabling Carbon Copy (Cc:) field prompting:

Use the set and unset commands to enable and disable the Cc: field.

You can enable or disable the Cc: field in the way shown in the following examples:

  • set askcc — Carbon copy (Cc:) field prompting is enabled by editing the .mailrc file askcc option.
  • unset askcc — Carbon copy (Cc:) field prompting is disabled by editing the .mailrc file askcc option.

Aliases and distribution lists

By creating aliases and distribution lists, you can manage the addressees and addresses that you commonly use with greater ease.

Before creating an alias or distribution list, make sure that the following conditions are true:

  1. The mail program must be installed on your system.

  2. You must know the names and addresses of users you want to include in your alias or distribution list.

You can create an alias or distribution list in the following ways:

  • alias — kath kathleen@gtwn In this example, the alias kath has been listed for user kathleen at address gtwn. After you have added this line to your $HOME/.mailrc file, to send a message to Kathleen, type the following at the command line prompt: mail kath You are now able to send mail to Kathleen using the kath alias.
  • alias — dept dee@merlin anne@anchor jerry@zeus bill carl After you have added this line to your $HOME/.mailrc file, to send a message to your department, type the following at the command line prompt: mail dept The message you now create and send will go to dee on system merlin, anne on system anchor, jerry on system zeus, and to bill and carl on the local system.

To list the aliases and distribution lists, type the following at the mailbox prompt:

alias

OR

text
a

A list of aliases and distribution lists is displayed.

Changes to the number of message headers or message text lines displayed in the mail program:

By changing the .mailrc file, you can customize the ability to scroll through mailbox lists or through actual messages.

In order to make these changes, the mail program must be installed on your system.

Changing the number of displayed lines of the message list:

Each message in your mailbox has a one-line heading in the message list. If you have more than 24 messages, the first headings from the message list scroll past the top of your screen. The set screen option controls how many lines of the list are displayed at a time.

To change the number of lines of the message list that are displayed at a time, in your $HOME/.mailrc file, type:

text
set screen=20

In this example, the system will display 20 message headers at a time. Use either the h or z subcommand to view additional groups of headers. You can also type this subcommand at the mailbox prompt.

Changing the number of displayed lines in a long message:

If you display a message with more than 24 lines, the first lines of the message scroll past the top of the screen. You can use the pg command from within mail to browse through long messages if you have included the set crt option in the .mailrc file.

The set crt option controls how many lines a message must contain before the pg command is started.

For example, if you use the t subcommand to read a long message, only one screen (or page) is displayed. The page is followed by a colon prompt to let you know there are more pages. Press the Enter key to display the next page of the message. After the last page of the message is displayed, there is a prompt similar to the following:

text
EOF:

At the prompt, you can enter any valid pg subcommand. You can display previous pages, search the message for character strings, or quit reading the message and return to the mailbox prompt.

The set crt option is entered in the .mailrc file as:

set crt=Lines

For example:

text
set crt=20

specifies that a message must be 20 lines before the pg command is started. The pg command is started when you read messages with more than 20 lines.

Changing the number of displayed lines at the top of a message:

The top subcommand enables you to scan through a message without reading the entire message.

You control how many lines of a message are displayed by setting the toplines option as follows:

text
set toplines= Lines

In this subcommand, the Lines variable is the number of lines, starting from the top and including all header fields, that are displayed with the top subcommand.

For example, if user Amy has the following line in her .mailrc file:

text
set toplines=10

when Amy runs the mail command to read her new messages, the following text is displayed:

text
Mail Type ? for help.
"/usr/mail/amy": 2 messages 2 new>
N 1 george  Wed Jan 6 9:47  11/257 "Dept Meeting"
N 2 mark    Wed Jan 6 12:59 17/445 "Project Planner"

When Amy uses the top subcommand to browse through her messages, the following partial message is displayed:

text
top 1
Message 1:
From george Wed Jan 6 9:47 CST 1988
Received: by zeus
    id AA00549; Wed, 6 Jan 88 9:47:46 CST
Date: Wed, 6 Jan 88 9:47:46 CST
From: george@zeus
Message-Id: <8709111757.AA00178>
To: amy@zeus
Subject: Dept Meeting
Please plan to attend the department meeting on Friday
at 1:30 in the planning conference room. We will be

The message is partially displayed because toplines is set to 10. Only lines 1 (the Received: field) through 10 (the second line of the message body) are displayed. The first line, From george Wed Jan 6 9:47 CST 1988, is always present and does not count in the toplines option.

Displaying information in a message

By changing the .mailrc file, you can control what header information is displayed in a message.

Some header information might be already turned off. Examine your /usr/share/lib/Mail.rc file for ignored header fields.

text
Prerequisites

The mail program must be installed on your system.

Preventing the Date, From, and To headers from being displayed:

Every message has several header fields at the top. These header fields are displayed when you read a message. You can use the ignore subcommand to suppress the display of header fields when a message is read.

The format for the ignore subcommand is:

text
ignore [ FieldList ]

The FieldList can consist of one or more field names that you want to ignore when you display a message. For example, if user Amy includes the following line in her .mailrc file:

text
ignore date from to

and the file /usr/share/lib/Mail.rc has the line:

text
ignore received message-id

the result of using the t subcommand is:

text
t 1
Message 1:
From george Wed Jan 6 9:47 CST 1988
Subject: Dept Meeting
Please plan to attend the department meeting on Friday
at 1:30 in the planning conference room. We will be
discussing the new procedures for using the project
planning program developed by our department.

The Received:, Date:, From:, Message-Id:, and To: fields are not displayed. To display these fields, use a T or P subcommand or the top subcommand.

Note: In the example, the From line is displayed. This is not the same as the From: field that has been listed in the FieldList for the ignore subcommand.

Listing the ignored header fields:

Use the ignore subcommand to list ignored header fields.

To get a list of the currently ignored header fields, at the mailbox prompt, type:

text
ignore

A list of all currently ignored headers is displayed. For example:

text
mail-from
message-id
return-path

Resetting the header fields:

To reset the header fields, use the retain subcommand.

For example:

text
retain date

Listing the retained header fields:

Use the retain subcommand to list retained header fields.

To see which header fields are currently retained, enter the retain subcommand without a header field parameter.

Preventing the banner from displaying:

The mail banner is the line at the top of the list of messages that shows the name of the mail program when you issue the mail command.

It is similar to the following line:

text
Mail [5.2 UCB] [Workstation 3.1] Type ? for help.

To prevent the banner from displaying when you start the mail program, add the following line to your $HOME/.mailrc file:

text
set quiet

Another option that suppresses the mail banner is:

text
set noheader

With this option in the .mailrc file, the list of messages in your mailbox is not displayed. When you start the mail program, the only response is the mailbox prompt. You can get a list of messages by typing the (h)eader subcommand.

Combining the delete and print commands:

Use the autoprint option to combine the delete and print subcommands.

After you read a message, you can delete it with the d subcommand. You can display the next message with the p subcommand. Combine these subcommands by typing the following line in your .mailrc file:

text
set autoprint

With the set autoprint option in the .mailrc file, the d subcommand deletes the current message and displays the next.

Creating default folders to store messages

Default folders allow you to store messages.

The mail program must be installed on your system.

Use the following procedure to create a letters mailbox directory to store messages in folders:

  1. To check if the set folder option has been enabled in the .mailrc file, at the mailbox prompt, type:
text
set

If the set folder option has been enabled, the system responds with the following:

text
folder /home/george/letters

In this example, letters is the directory in which mail folders will be stored.

  1. If the set folder option has not been enabled, make a set folder entry in the .mailrc file:
text
set folder=/home/george/letters

In this example, /home/george is George's home directory and letters is the directory in which mail folders will be stored. The set folder option will allow you to use the plus sign (+) shorthand notation to save messages in your letters directory.

  1. If a letters directory does not exist, you must create a letters directory in your home directory. From your home directory, at your system command line, type:
text
mkdir letters

Use the following procedure to keep a record of messages you send to others:

  1. Type the following statement in your .mailrc file:
text
set record=letters/mailout
  1. If a letters directory does not exist, you must create a letters directory in your home directory. From your home directory, at your system command line, type:
text
mkdir letters
  1. To read copies of the messages you have sent to others, type:
text
mail -f +mailout

In this example, the file mailout contains copies of the messages you have sent to others.

Text editors for typing messages

Use the set EDITOR=PathName option to define the text editor with which you type messages.

The mail program must be installed on your system.

  • set EDITOR=PathName — This option in your .mailrc file defines the editor that you activate with the ~e key sequence. The value of PathName must be the full path name to the editor program you want to use. To change to the e editor, while in the mail program, type: ~e This sequence activates the e editor or other editor that you have defined in the .mailrc file. Edit your mail message using this editor.
  • set VISUAL=PathName — This option in your .mailrc file defines the editor that you activate with the ~v key sequence. The value of PathName must be the full path name to the editor program that you want to use. The default is /usr/bin/vi. To change to the vi editor while in the mail program, type: ~v This sequence activates the vi editor or other editor that you have defined in the .mailrc file. Edit your mail message using this editor.

mail 명령 하위 명령

mail 명령은 여러 기능을 하는 하위 명령을 씁니다. 이 주제는 mail 명령과 그 하위 명령의 참조입니다.

mail을 실행하는 명령

명령 설명
mail 시스템 메일함을 표시합니다.
mail -f 개인 메일함(mbox)을 표시합니다.
mail -f +folder 메일 폴더를 표시합니다.
mail user@address 지정한 사용자에게 보낼 메시지를 만듭니다.

mail 프로그램의 메일함 하위 명령

mail 프로그램이 메일함을 처리할 때는 입력을 기다린다는 뜻으로 메일함 프롬프트를 보여 줍니다. 메일함 프롬프트는 새 줄 맨 앞의 앰퍼샌드(&)이며, 여기서 메일함 하위 명령을 입력합니다.

mail 프로그램 제어 하위 명령

하위 명령 설명
q 끝내며, 이번 세션에 입력한 메일함 하위 명령을 적용합니다.
x 끝내며, 메일함을 원래 상태로 되돌립니다.
! 셸을 시작해 명령을 실행하고 메일함으로 돌아옵니다.
cd dir 디렉터리를 dir이나 $HOME으로 바꿉니다.

mail 프로그램 표시 하위 명령

하위 명령 설명
t msg_list의 메시지나 현재 메시지를 표시합니다.
n 다음 메시지를 표시합니다.
f msg_list msg_list에 있는 메시지의 머리글을, msg_list가 없으면 현재 메시지의 머리글을 표시합니다.
h num 메시지 num이 든 묶음의 머리글을 표시합니다.
top num 메시지 일부를 표시합니다.
set 켜진 .mailrc 옵션을 모두 표시합니다.
ignore 무시하는 머리글 필드를 모두 표시합니다.
folder 현재 폴더의 메시지 수와 폴더 경로 이름을 표시합니다.

메시지 처리

메시지를 편집, 삭제, 되살리기, 덧붙이기, 보존하는 하위 명령입니다.

하위 명령 설명
e num 메시지 num을 편집합니다(기본 편집기는 e).
d msg_list msg_list의 메시지나 현재 메시지를 지웁니다.
u msg_list msg_list의 지운 메시지를 되살립니다.
s msg_list +file 메시지를 머리글과 함께 file에 덧붙입니다.
w msg_list +file 메시지를 본문만 file에 덧붙입니다.
pre msg_list 메시지를 시스템 메일함에 남겨 둡니다.

새 메일 하위 명령

하위 명령 설명
m addrlist addrlist의 주소로 새 메시지를 만들어 보냅니다.
r msg_list 메시지를 보낸 사람과 받은 사람들에게 답장을 보냅니다.
R msg_list 메시지를 보낸 사람에게만 답장을 보냅니다.
a 별칭과 그 주소 목록을 표시합니다.

mail 편집기 하위 명령

mail 편집기가 처리될 때는 입력을 기다린다는 뜻으로 mail 편집기 프롬프트를 보여 주며, 여기서 mail 편집기 하위 명령을 입력합니다.

mail 편집기 제어 하위 명령

하위 명령 설명
~q 현재 메시지를 저장하거나 보내지 않고 편집기를 끝냅니다.
~p 메시지 버퍼의 내용을 표시합니다.
~: mcmd 메일함 하위 명령(mcmd)을 실행합니다.
EOT 메시지를 보냅니다(많은 터미널에서 Ctrl-D).
. 현재 메시지를 보냅니다.

머리글에 더하는 하위 명령

하위 명령 설명
~h To:, Subject:, Cc:, Bcc: 필드에 더합니다.
~t addrlist addrlist의 사용자 주소를 To: 필드에 더합니다.
~s subject Subject 필드를 subject로 지정한 문자열로 설정합니다.
~c addrlist addrlist의 사용자 주소를 Cc:(참조) 필드에 더합니다.
~b addrlist addrlist의 사용자 주소를 Bcc:(숨은 참조) 필드에 더합니다.

메시지에 더하는 하위 명령

하위 명령 설명
~d dead.letter의 내용을 메시지에 덧붙입니다.
~r filename filename의 내용을 메시지에 덧붙입니다.
~f numlist 메시지 번호 numlist의 내용을 덧붙입니다.
~m numlist 메시지 번호 numlist의 내용을 들여 써서 덧붙입니다.

메시지를 바꾸는 하위 명령

하위 명령 설명
~e e 편집기로 메시지를 편집합니다(기본은 e).
~v vi 편집기로 메시지를 편집합니다(기본은 vi).
~w filename 메시지를 filename에 씁니다.
~! command 셸을 시작해 command를 실행하고 편집기로 돌아옵니다.
  • ~| command: 메시지를 command의 표준 입력으로 보내고, 메시지를 그 명령의 표준 출력으로 바꿉니다.

비밀 메일 하위 명령

비밀 메일 프로그램이 비밀 메일함을 처리할 때는 입력을 기다린다는 뜻으로 비밀 메일함 프롬프트를 보여 줍니다. 비밀 메일함 프롬프트는 새 줄 맨 앞의 물음표(?)이며, 여기서 비밀 메일함 하위 명령을 입력합니다.

비밀 메일 하위 명령

명령 설명
xsend barbara 지정한 사용자에게 보낼 메시지를 만듭니다.
xget 비밀 메일함을 표시합니다.

메일함 작업

여러 메일함 작업을 하는 하위 명령입니다.

하위 명령 설명
q 읽지 않은 메시지를 남겨 두고 끝냅니다.
n 현재 메시지를 지우고 다음 메시지를 표시합니다.
d 현재 메시지를 지우고 다음 메시지를 표시합니다.
Return 키 현재 메시지를 지우고 다음 메시지를 표시합니다.
! 셸 명령을 실행합니다.
s 메시지를 지정한 파일이나 mbox에 저장합니다.
w 메시지를 지정한 파일이나 mbox에 저장합니다.
영어 원문

Mail command subcommands

The mail command uses various subcommands that perform different functions.

This topic is used as a reference for the mail command and its subcommands.

Commands to execute mail

Use these system commands to execute mail.

  • mail — Displays the system mailbox.
  • mail -f — Displays your personal mailbox (mbox).
  • mail -f +folder — Displays a mail folder.
  • mailuser@address — Addresses a message to the specified user.

Mailbox subcommands in the mail program

When the mail program is processing a mailbox, it displays the mailbox prompt to indicate that it is waiting for input.

The mailbox prompt is an ampersand (&) displayed at the beginning of a new line. At the prompt, you can enter any of the mailbox subcommands.

Mail program control subcommands:

Use these subcommands for controlling the mail program.

  • q — Quits and applies the mailbox subcommands entered this session.
  • x — Quits and restores the mailbox to original state.
  • ! — Starts a shell, runs a command, and returns to the mailbox.
  • cd dir — Changes directory to dir or $HOME.
  • Mail program display subcommands:

Use these subcommands to control mail program displays.

  • t — Displays the messages in msg_list or the current message.
  • n — Displays the next message.
  • f msg_list — Displays the headings of messages in msg_list or of the current message if msg_list is not provided.
  • h num — Displays the headings of groups containing message num.
  • top num — Displays a partial message.
  • set — Displays a list of all enabled .mailrc options.
  • ignore — Displays a list of all the ignored header fields.
  • folder — Displays the number of messages in the current folder along with the path name of the folder.
  • Message handling:

Use these subcommands to edit, delete, recall, append, or retain messages.

  • e num — Edits the message num (default editor is e).
  • d msg_list — Deletes the messages in msg_list or the current message.
  • u msg_list — Recalls deleted messages in msg_list.
  • s msg_list +file — Appends messages (with headings) to file.
  • w msg_list +file — Appends messages (text only) to file.
  • pre msg_list — Keeps messages in the system mailbox.
  • New mail subcommands:

Use these subcommands when creating new mail messages.

  • m addrlist — Creates and sends a new message to the addresses in addrlist.
  • r msg_list — Sends a reply to senders and recipients of messages.
  • R msg_list — Sends a reply only to senders of messages.
  • a — Displays a list of aliases and their addresses.

Mail editor subcommands

When the mail editor is processed, it displays the mail editor prompt to indicate that it is waiting for input.

At the prompt, you can enter any of the mail editor subcommands.

Mail editor control subcommands:

Use the following subcommands to control the mail editor.

  • ~q — Quits the editor without saving or sending the current message.
  • ~p — Displays the contents of the message buffer.
  • ~: mcmd — Runs a mailbox subcommand (mcmd).
  • EOT — Sends message (Ctrl-D on many terminals).
  • . — Sends the current message.
  • Add to heading subcommands:

Use these subcommands to add different heading items to messages.

  • ~h — Adds to the To:, Subject:, Cc:, and Bcc: fields.
  • ~t addrlist — Adds the user addresses in addrlist to the To: field.
  • ~s subject — Sets the Subject field to the string specified by subject.
  • ~c addrlist — Adds the user addresses in addrlist to the Cc: (carbon copy) field.
  • ~b addrlist — Adds the user addresses in addrlist to the Bcc: (blind carbon copy) field.
  • Add to message subcommands:

Use these subcommands to add contents to a message.

  • ~d — Appends the contents of dead.letter to the message.
  • ~r filename — Appends the contents of filename to the message.
  • ~f numlist — Appends the contents of message numbers numlist.
  • ~mnumlist — Appends and indents the contents of message numbers numlist.
  • Change message subcommands:

Use these subcommands to edit messages.

  • ~e — Edits the message using the e editor (default is e).
  • ~v — Edits the message using the vi editor (default is vi).
  • ~w filename — Writes the message to filename.
  • ~! command — Starts a shell, runs command, and returns to the editor.
  • ~| command — Pipes the message to standard input of command and replaces the message with the standard output from that command.

Secret mail subcommands

When the secret mail program processes a secret mailbox, it displays the secret mailbox prompt to indicate that it is waiting for input.

The secret mailbox prompt is a question mark (?) displayed at the beginning of a new line. At the prompt, you can enter any of the secret mailbox subcommands.

Secret mail subcommands:

Use the following subcommands to send secret mail.

  • xsend barbara — Addresses a message to the specified user.
  • xget — Displays the secret mailbox.

Mailbox tasks

The following subcommands accomplish various mailbox tasks.

  • q — Quits, leaving unread messages.
  • n — Deletes the current message and displays the next message.
  • d — Deletes the current message and displays the next message.
  • Return key — Deletes the current message and displays the next message.
  • ! — Executes a shell command.
  • s — Saves the message in the named file or mbox.
  • w — Saves the message in the named file or mbox.