[AIX 네트워크 관리 3] 메일 (2) 메일 만들기와 보내기
https://archive.horanglab.com/posts/aix-net-mail-2
핵심 정리
- 주소 형식: 로컬 사용자는
mail ryan, 같은 네트워크는mail ryan@tybalt, 다른 네트워크는mail [email protected](도메인 주소), 여러 명은 공백으로 구분합니다. UUCP 경로는mail arthur!lancelot!merlin!ken처럼!로 잇습니다. - mail 편집기는 줄 단위 편집기이며, 줄 맨 앞의
~(이스케이프 문자,.mailrc의set escape로 바꿈)로 하위 명령을 씁니다:~e/~v(다른 편집기),~p(표시),~q(보내지 않고 끝냄),~r 파일(파일 넣기),~f/~m(메시지 넣기),~d(dead.letter 넣기),~s/~t/~c/~b(머리글),~h(머리글 편집). - 보내기는 줄 맨 앞에서 Ctrl-D나
.. 답장은r(보낸 사람과 Cc 모두)·R(보낸 사람만), 메일함에서 새 메일은m 주소입니다. - 모든 메일을 돌리려면 홈 디렉터리에
.forward파일(주소를 쉼표로)을 만듭니다. 있는 동안에는 메일을 받지 못하며, 지우면 끝납니다. - 휴가 응답:
vacation -I로 초기화하고.forward에carl, |"/usr/bin/vacation carl"를 넣은 다음$HOME/.vacation.msg에 메시지를 씁니다(기본 1주에 한 번,-f10d면 10일).
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같음) |
| 원문 | Networks and communication management — 5.3판 2033쪽, 6.1판 2134쪽 |
| 파일 | $HOME/.mailrc, $HOME/.forward, $HOME/.vacation.msg, /usr/share/lib/vacation.def, $HOME/dead.letter |
| 관련 명령어 | mail, vacation, xsend, xget, enroll, fmt, spell |
메일 만들기와 보내기
mail 프로그램으로 다른 사용자에게 메시지를 만들고, 보내고, 답하고, 전달하거나 ASCII 파일을 보낼 수 있습니다.
ASCII 파일은 예를 들어 즐겨 쓰는 편집기로 쓴 문서나 프로그램 소스 파일일 수 있습니다.
로컬 시스템의 사용자, 내 네트워크의 사용자, 연결된 다른 네트워크의 사용자에게 메시지와 파일을 보낼 수 있습니다. 보낼 때 받는 사람이 시스템에 로그인해 있지 않아도 됩니다. 메일은 사용자의 주소로 보냅니다.
메일 주소 지정
메일은 사용자의 주소로 보냅니다. 로그인 이름과 시스템 이름이 든 주소가 메일 메시지가 갈 곳을 정합니다.
보통 다른 사용자에게 메시지를 보내려면 다음처럼 mail 명령과 주소를 입력합니다.
mail User @ Address
Address 매개변수의 형식은 받는 사람이 어디 있느냐에 따라 다릅니다. 사무실 동료에게 쪽지를 보내는 것과 비슷합니다. 예닐곱 명인 작은 부서에서 일하는 Ryan에게 쪽지를 보낼 때는 봉투에 이름만 써서 사내 우편에 넣으면 됩니다. 그러나 Ryan이 다른 부서에 있으면 봉투에 정보를 더 적어야 할 수 있습니다.
Ryan
Payroll
Ryan이 다른 지역에 있으면 메시지가 확실히 닿도록 정보를 더 적어야 할 수 있습니다.
Ryan
Payroll
Gaithersburg
전자 메일도 비슷한 순서로 주소를 지정합니다.
| 명령 | 설명 |
|---|---|
mail ryan |
로컬 시스템의 사용자에게 메일을 보낼 때는 주소에 로그인 이름만 있으면 됩니다. |
mail ryan@tybalt |
로컬 네트워크의 사용자에게 메일을 보낼 때는 시스템(노드) 주소 전체를 입력합니다. |
mail [email protected] |
연결된 다른 네트워크의 사용자에게 메일을 보낼 때는 시스템 주소와 네트워크 주소 전체를 입력합니다. |
mail dept71 |
별칭(alias)이나 배포 목록으로 특정 그룹에 메일을 보낼 수 있습니다. 이렇게 하려면 .mailrc 파일에 별칭이나 배포 목록을 만들어야 합니다. 별칭 만들기는 "별칭과 배포 목록"(메일 (3))을 봅니다. |
여러 사용자에게 보내기
여러 사용자에게 동시에 메일을 보내려면 사용자 이름을 공백으로 구분합니다. 예:
ryan@tybalt suemc@julius dmorgan@ophelia
로컬 시스템의 사용자에게 보내기
로컬 시스템의 사용자(로그인 이름이 /etc/passwd 파일에 있는 사람)에게 메시지를 보내려면 로그인 이름을 주소로 씁니다. 시스템 명령줄 프롬프트에서 다음처럼 씁니다.
mail LoginName
| 명령 | 설명 |
|---|---|
mail ryan |
Ryan이 내 시스템에 있고 로그인 이름이 ryan이면, 이 명령은 mail 프로그램을 시작해 메시지를 만들게 하고 로컬 로그인 이름 ryan에게 보내려 합니다. 메시지가 잘 배달되면 따로 알려 주지 않습니다. Ryan이 내 시스템에 없으면 메일 시스템이 바로 오류 메시지를 돌려주고, 보내지 못한 메시지를 내 시스템 메일함으로 돌려보냅니다. |
내 네트워크의 사용자에게 보내기
mail 명령으로 내 네트워크의 사용자에게 메시지를 보냅니다. 주소에 사용자의 로그인 이름과 시스템 이름을 넣습니다. 로컬 네트워크를 거쳐 다른 시스템의 사용자에게 메시지를 보내려면 명령줄에 다음처럼 입력합니다.
| 명령 | 설명 |
|---|---|
mail LoginName@SystemName |
예를 들어 Ryan이 zeus 시스템에 있으면 mail ryan@zeus로 메시지를 만들어 보냅니다. 이 명령은 mail 프로그램을 시작해 메시지를 만들게 하고 zeus 시스템의 로그인 이름 ryan에게 보내려 합니다. 잘 배달되면 아무 알림 없이 시스템 프롬프트로 돌아옵니다. 메일 주소가 틀리면 오류 메시지가 나옵니다. |
참고: 로컬 네트워크를 거쳐 다른 시스템의 사용자에게 메시지를 보내려면 로그인 이름과 다른 시스템의 이름을 알아야 합니다. 사용자를 나타내는 정보를 보는 방법은 통신 시스템 명령(개요 글)을 봅니다.
다른 네트워크의 사용자에게 보내기
내 네트워크가 다른 네트워크에 연결되어 있으면 다른 네트워크의 사용자에게 메일을 보낼 수 있습니다.
주소 매개변수는 내 네트워크와 다른 네트워크가 서로를 어떻게 주소 지정하고 어떻게 연결되어 있느냐에 따라 다릅니다. 네트워크 구성에 따라 다음 가운데 하나를 합니다.
- 이름과 주소의 중앙 데이터베이스를 쓰면 다음처럼 mail 명령을 씁니다.
mail LoginName @ SystemName
네트워크가 이름의 중앙 데이터베이스를 쓰면, 연결된 네트워크의 사용자에게 메일을 보낼 때 정보가 더 필요 없습니다. 로컬 네트워크 사용자와 같은 주소 형식을 씁니다. 이런 주소 지정은 네트워크의 성격상 이름의 중앙 데이터베이스를 유지할 수 있을 때 잘 맞습니다.
- 네트워크가 도메인 이름 주소 지정을 쓰면 다음처럼 mail 명령을 씁니다.
mail LoginName @ SystemName . DomainName
넓은 지역에 흩어진, 서로 관련 없는 큰 네트워크에 걸친 네트워크에서는 이름의 중앙 데이터베이스를 둘 수 없습니다. DomainName 매개변수는 서로 연결된 큰 네트워크 그룹에 정의된 구조 안에서 로컬 네트워크를 기준으로 원격 네트워크를 정합니다. 예를 들어 다음 명령을 입력하면
mail [email protected]
메일은 merlin 시스템의 사용자 kelly에게 갑니다. merlin은 odin이라는 로컬 네트워크에 있고, odin은 도메인이 valryanl인 두 번째 네트워크에 연결되어 있습니다.
BNU나 UUCP 링크를 거치는 메일 주소
BNU(Basic Networking Utilities)나 UUCP(UNIX-to-UNIX Copy Program) 링크를 거쳐 다른 시스템의 사용자에게 메시지를 보낼 수 있습니다.
BNU나 다른 버전의 UUCP로 내 시스템에 연결된 다른 시스템의 사용자에게 메시지를 보내려면 다음을 알아야 합니다.
- 로그인 이름
- 다른 시스템의 이름
- 그 시스템까지의 물리 경로
내 시스템을 다른 시스템에 연결한 담당자가 다른 시스템의 주소를 지정하는 데 필요한 라우팅 정보를 줄 수 있어야 합니다.
내 컴퓨터에 BNU나 UUCP 링크가 있을 때는 시스템 명령줄 프롬프트에서 다음처럼 씁니다.
| 명령 | 설명 |
|---|---|
mail UUCPRoute!LoginName |
로컬 컴퓨터에 원격 시스템에 닿을 수 있는 BNU나 UUCP 연결이 있으면 이 형식으로 주소를 지정합니다. LoginName은 원격 시스템에서 받는 사람의 로그인 이름이고, UUCPRoute는 메시지가 UUCP 네트워크를 따라 거쳐야 할 물리 경로입니다. 중간 UUCP 시스템 없이 원격 시스템에 바로 연결되어 있으면 이 값은 원격 시스템의 이름입니다. |
mail arthur!lancelot!merlin!ken |
원하는 원격 시스템에 닿기 전에 중간 UUCP 시스템을 하나 이상 거쳐야 하면, 이 값은 중간 시스템 목록입니다. 가장 가까운 시스템부터 가장 먼 시스템까지 느낌표(!)로 구분해 적습니다. 메시지가 arthur와 lancelot을 차례로 거쳐 merlin에 닿아야 할 때 이 예를 따릅니다. |
mail merlin!ken |
로컬 시스템에 merlin이라는 시스템으로 가는 UUCP 링크가 있고 사이에 다른 UUCP 시스템이 없으면, 그 시스템의 ken에게 메시지를 보낼 수 있습니다. |
BNU나 UUCP 링크가 다른 컴퓨터에 있을 때: 로컬이나 광역 네트워크 환경에서는 네트워크의 시스템 하나가 원격 시스템으로 가는 BNU나 다른 UUCP 연결을 가지고 있을 수 있습니다. 그 UUCP 연결로 원격 UUCP 시스템의 사용자에게 메시지를 보낼 수 있습니다. 시스템 명령줄 프롬프트에서 다음처럼 씁니다.
| 주소 | 설명 |
|---|---|
mail @arthur:merlin!ken |
인터넷 시스템 arthur를 거쳐 UUCP 시스템 merlin의 ken에게 메일을 보냅니다. @는 인터넷 주소 지정, !는 UUCP 주소 지정의 구분자이고, :는 두 주소를 잇습니다. 이 형식에서는 중간 시스템의 사용자에게 보내는 것이 아니므로 도메인 주소의 @ 앞에 로그인 이름이 없습니다. |
mail @arthur:odin!acct.dept!kelly |
인터넷 시스템 arthur에서 odin을 거쳐 UUCP 시스템 acct.dept의 kelly에게 메일을 보냅니다. |
mail @odin.uucp:@dept1.UUCP:@dept2:bill@dept3 |
odin과 dept1 UUCP 링크를 거친 다음 dept2와 dept3 시스템 사이의 로컬 네트워크 링크로 bill@dept3에게 메일을 보냅니다. 이런 UUCP 주소 표기를 쓰려면 /etc/sendmail.cf 파일을 그에 맞게 구성해야 합니다. 시스템 관리자에게 문의합니다. |
다른 네트워크의 사용자에게 메일을 자주 보내면 사용자 주소가 든 별칭을 만들어 두면 시간을 아낄 수 있습니다. 별칭과 배포 목록을 봅니다.
mail 편집기 시작하기
mail 프로그램은 메시지를 만드는 줄 단위 편집기를 제공합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- mail 프로그램이 시작되어 있어야 합니다.
이 편집기에서는 메시지를 한 줄씩 입력하고, Enter 키를 눌러 새 줄로 가서 텍스트를 더 입력합니다. Enter 키를 누른 뒤에는 그 줄을 바꿀 수 없습니다. 그러나 Enter 키를 누르기 전에는 Backspace와 Delete 키로 그 줄의 내용을 지워 고칠 수 있습니다. mail 편집기 하위 명령으로 전체 화면 편집기에 들어가 메시지를 고칠 수도 있습니다.
mail 편집기로 메일을 만들면 date:와 from: 필드는 시스템이 자동으로 채웁니다. subject:와 cc: 필드는 채울지 고를 수 있습니다. 이 필드들은 일반 업무 편지의 본문과 비슷합니다.
mail 편집기에는 메시지에 다른 작업을 하게 하는 제어 하위 명령이 많이 있습니다. 이 하위 명령은 각각 새 줄에 입력해야 하며, 특수 이스케이프 문자로 시작해야 합니다. 이스케이프 문자는 기본으로 물결표(~)이며, .mailrc 파일에 set escape 옵션을 넣어 다른 문자로 바꿀 수 있습니다.
시스템 명령줄 프롬프트나 메일함 프롬프트에서 다음처럼 씁니다.
| 명령 | 설명 |
|---|---|
mail User@Address |
명령줄 프롬프트에서 냅니다. 메시지는 User@Address로 갑니다. Address 매개변수는 받는 사람의 위치에 따라 다릅니다. |
m User@Address |
메일함 프롬프트에서 냅니다. 메시지는 User@Address로 갑니다. Address 매개변수는 받는 사람의 위치에 따라 다릅니다. |
R이나 r 하위 명령으로 메시지에 답할 때도 mail 편집기가 시작됩니다. 메시지에 답하는 방법은 메일 보내기와 메일에 답하기를 봅니다.
메시지 편집
메일함에 있는 동안 메일함 프롬프트에서 e(edit)나 v(visual) 하위 명령을 입력해 기존 메시지에 정보를 더할 수 있습니다.
mail 편집기에서는 Enter 키를 누르고 다음 줄로 넘어간 뒤에는 그 줄의 정보를 바꿀 수 없습니다. 보내기 전에 다른 편집기로 메시지를 편집해 내용을 바꿀 수 있습니다.
다른 편집기로 메시지를 편집하기 전에 다음 조건을 확인합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
.mailrc파일에 다른 편집기를 다음처럼 정의해야 합니다.
set EDITOR= PathName
이것이 ~e 하위 명령으로 시작할 편집기를 정합니다. PathName 값은 쓰려는 편집기 프로그램의 전체 경로 이름이어야 합니다. 예를 들어 set EDITOR=/usr/bin/vi는 ~e 하위 명령에 vi 편집기를 쓰도록 정합니다.
- 메일함의 메시지에 정보를 더하려면 시스템 메일함, 다른 메일함, 폴더의 메일을 읽으려고 mail 명령을 시작해 두어야 합니다.
- 메시지를 만드는 중에 다른 편집기를 시작하려면 mail 편집기 프롬프트에 있어야 합니다.
메일함의 특정 메시지에 정보 더하기
메일함의 메시지에 정보를 더하려면 e나 v 하위 명령 뒤에 메시지 번호를 입력합니다.
| 하위 명령 | 설명 |
|---|---|
e 13 |
e 편집기(또는 .mailrc에 정의한 편집기)로 메시지 13에 메모를 더합니다. |
v 15 |
vi 편집기(또는 .mailrc에 정의한 편집기)로 메시지 15에 메모를 더합니다. |
메시지 번호를 지정하지 않으면 mail 명령은 현재 메시지로 편집기를 시작합니다. 편집기에서 나오면 메일함 프롬프트로 돌아와 메일함의 메시지를 계속 처리합니다.
mail 편집기에서 현재 메시지 바꾸기
mail 편집기의 줄 맨 앞에서 ~e나 ~v 하위 명령을 씁니다.
| 하위 명령 | 설명 |
|---|---|
~e |
e 편집기나 .mailrc에 정의한 다른 편집기를 시작합니다. |
~v |
vi 편집기나 .mailrc에 정의한 다른 편집기를 시작합니다. |
이렇게 하면 현재 메시지의 텍스트를 편집할 수 있습니다. 다른 편집기에서 나오면 mail 편집기로 돌아옵니다.
mail 편집기에서 메시지 줄 표시하기
~p 하위 명령으로 mail 편집기에서 메시지 줄을 표시합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- mail 편집기에서 메시지를 표시하려면 mail 편집기를 시작해 두어야 합니다(mail 편집기 시작하기 참고).
| 하위 명령 | 설명 |
|---|---|
~p |
메시지의 머리글 정보를 포함해 메시지 내용을 표시합니다. 텍스트는 화면 아래에서 위로 올라갑니다. 메시지 끝 다음에는 mail 편집기의 (Continue) 프롬프트가 나옵니다. |
메시지가 한 화면보다 크고 stty 명령으로 터미널의 페이지 크기를 설정하지 않았으면, 텍스트가 끝까지 화면 위로 넘어가 버립니다. 큰 메시지의 내용을 보려면 mail 편집기 하위 명령으로 다른 편집기에서 메시지를 봅니다. 메시지 편집을 봅니다.
mail 편집기 끝내기
메시지를 보내지 않고 mail 편집기를 끝내려면 ~q 하위 명령이나 인터럽트 키(보통 Alt-Pause나 Ctrl-C)를 씁니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- mail 편집기를 시작해 두어야 합니다(mail 편집기 시작하기 참고).
텍스트를 입력한 적이 있으면 mail 명령은 메시지를 dead.letter 파일에 저장합니다.
| 하위 명령 | 설명 |
|---|---|
~q |
mail 편집기를 끝내며 메시지는 보내지 않습니다. 텍스트를 입력하지 않은 경우가 아니면 메시지를 홈 디렉터리의 dead.letter 파일에 저장합니다. 시스템 프롬프트가 나옵니다. |
| Ctrl-C | 인터럽트 키로 편집기를 끝내려면 break(Ctrl-C)나 interrupt(Alt-Pause)를 누릅니다. (Interrupt -- one more to kill letter)가 나오면 break나 interrupt를 한 번 더 누릅니다. (Last Interrupt -- letter saved in dead.letter)가 나오며 메시지는 보내지 않습니다. 텍스트를 입력하지 않은 경우가 아니면 메시지를 홈 디렉터리의 dead.letter에 저장합니다. 시스템 프롬프트가 나옵니다. |
참고: 메시지를 보내지 않고 mail 편집기를 끝내면 dead.letter 파일에 있던 내용은 쓰다 만 메시지로 바뀝니다. 그 파일을 되찾는 방법은 아래 "메시지에 파일과 특정 메시지를 넣는 옵션"을 봅니다.
메시지에 파일과 특정 메시지를 넣는 옵션
메일 메시지에 파일이나 특정 메시지를 넣으려면 먼저 다음 조건을 만족해야 합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- 받는 사람의 이름과 주소를 알아야 합니다.
- mail 편집기가 시작되어 있어야 합니다.
메시지에 파일 넣기: ~r 하위 명령으로 메시지에 파일을 더합니다.
| 하위 명령 | 설명 |
|---|---|
~r schedule |
schedule은 넣을 파일 이름입니다. 이 예에서는 schedule 파일의 내용이 쓰고 있는 메시지의 현재 끝에 들어갑니다. |
메시지 안에 특정 메시지 넣기: ~f나 ~m 하위 명령으로 내 메시지 안에 특정 메시지를 넣습니다.
| 하위 명령 | 설명 |
|---|---|
~f MessageList |
지정한 메시지(들)를 현재 메시지 끝에 덧붙이되 들여 쓰지 않습니다. 여백이 너무 넓어 ~m으로 넣기 어려운 메시지를 참고용으로 덧붙일 때도 씁니다. MessageList는 mail이 다루는 메일함이나 폴더의 올바른 메시지 번호를 가리키는 정수 목록이며, 간단한 번호 범위도 쓸 수 있습니다. 예를 들어 ~f 1-4는 메시지 1, 2, 3, 4를 쓰고 있는 메시지 끝에 왼쪽 여백에 맞춰(들여 쓰지 않고) 덧붙입니다. |
~m 2 |
지정한 메시지를 현재 메시지 끝에 덧붙입니다. 넣은 메시지는 보통 왼쪽 여백에서 탭 하나만큼 들여 쓰입니다. 이 예에서는 메시지 2를 현재 메시지에 덧붙입니다. |
~m 1 3 |
메시지 1, 메시지 3을 차례로 쓰고 있는 메시지 끝에 왼쪽 여백에서 탭 하나만큼 들여 써서 덧붙입니다. |
dead.letter 파일의 내용을 현재 메시지에 넣기: ~d 하위 명령을 씁니다.
| 하위 명령 | 설명 |
|---|---|
~d |
dead.letter 파일의 내용을 가져와 현재 메시지 끝에 덧붙입니다. (Continue) 프롬프트에서 메시지를 더 쓰거나 보냅니다. |
머리글 정보 편집
메시지의 머리글에는 라우팅 정보와 제목 요약이 들어 있습니다. 받는 사람을 적어도 한 명 지정해야 합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- mail 편집기를 시작해 메시지 편집을 시작합니다(mail 편집기 시작하기 참고).
나머지 머리글 정보는 필수가 아닙니다. 머리글에는 다음 정보가 들어갈 수 있습니다.
| 필드 | 설명 |
|---|---|
| To: | 메시지를 보낼 주소(들) |
| Subject: | 메시지 주제의 짧은 요약 |
| Cc: | 메시지 사본을 보낼 주소(들). 이 필드의 내용은 메시지를 받는 모든 사람에게 가는 메시지에 들어갑니다. |
| Bcc: | 숨은 참조 사본을 보낼 주소(들). 이 필드는 메시지를 받는 사람들에게 가는 메시지에 들어가지 않습니다. |
.mailrc 파일에 항목을 넣어 mail 프로그램이 이 필드의 정보를 자동으로 묻게 할 수 있습니다. 메일 프로그램 사용자 정의 옵션(메일 (3))을 봅니다.
Subject: 필드 설정하기
~s 하위 명령으로 Subject: 필드를 특정 구나 문장으로 설정합니다. 이 하위 명령은 Subject: 필드의 이전 내용(있으면)을 바꿉니다.
| 하위 명령 | 설명 |
|---|---|
~s Fishing Trip |
현재 Subject: Vacation인 필드를 Subject: Fishing Trip으로 바꿉니다. 참고: 이 하위 명령으로는 Subject: 필드에 덧붙일 수 없습니다. 머리글 정보 편집에 나오는 ~h 하위 명령을 씁니다. |
To:, Cc:, Bcc: 필드에 사용자 더하기
~t, ~c, ~b 하위 명령으로 머리글 필드에 사용자를 더합니다.
| 하위 명령 | 설명 |
|---|---|
~t geo@austin mel@gtwn |
To: mark@austin을 To: mark@austin geo@austin mel@gtwn으로 바꿉니다. |
~c geo@austin mel@gtwn |
Cc: mark@austin amy를 Cc: mark@austin amy geo@austin mel@gtwn으로 바꿉니다. |
~b geo@austin mel@gtwn |
Bcc: mark@austin을 Bcc: mark@austin geo@austin mel@gtwn으로 바꿉니다. |
참고: ~t, ~c, ~b 하위 명령으로는 To:, Cc:, Bcc: 필드의 내용을 바꾸거나 지울 수 없습니다. 머리글 정보 편집에 나오는 ~h 하위 명령을 씁니다.
mail 편집기에서 메시지 다시 서식화하기
메시지를 입력한 뒤 보내기 전에 fmt 셸 프로그램으로 메시지를 다시 서식화해 보기 좋게 만들 수 있습니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
fmt명령이 시스템에 설치되어 있어야 합니다.
mail 편집기의 새 줄 맨 앞에서 다음처럼 fmt 명령을 씁니다.
~| fmt: 문단마다 정의된 여백 안에서 내용을 다시 흘려 메시지의 모양을 바꿉니다(문단 사이에는 빈 줄이 있어야 함). 파이프 하위 명령은 메시지를 명령의 표준 입력으로 보내고, 메시지를 그 명령의 표준 출력으로 바꿉니다.
주의: 메시지 안에 다른 메시지가 들어 있거나 외부 파일에서 가져온 미리 서식화된 정보가 있으면 fmt 명령을 쓰지 마십시오. fmt는 넣은 메시지의 머리글 정보를 다시 서식화하며 미리 서식화된 정보의 형식을 바꿀 수 있습니다. 대신 ~e나 ~v 하위 명령으로 전체 화면 편집기에 들어가 메시지를 다시 서식화합니다.
mail 편집기에서 맞춤법 확인하기
spell 명령은 메시지의 맞춤법을 확인합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- 텍스트 서식화 프로그램이 시스템에 설치되어 있어야 합니다.
mail 편집기에서 spell 명령으로 메시지의 틀린 단어를 확인합니다.
- 메시지를 임시 파일에 씁니다. 예를 들어
checkit파일에 쓰려면 다음을 입력합니다.
~w checkit
- 임시 파일을 입력으로
spell명령을 실행합니다.
~! spell checkit
이 예에서 느낌표(!)는 셸을 시작해 명령을 실행하고 메일함으로 돌아오는 하위 명령입니다. spell 명령은 알려진 단어 목록에 없는 단어 목록을 보여 주고, mail 프로그램으로 돌아왔음을 나타내는 느낌표(!)를 이어서 보여 줍니다.
- 단어 목록을 살펴보고 편집기로 고쳐야 할지 판단합니다.
- 다음을 입력해 임시 파일을 지웁니다.
~! rm checkit
메일 보내기
메시지를 만든 뒤 보내는 절차입니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- 받는 사람의 이름과 주소를 알아야 합니다.
- 명령줄에 mail 명령과 받는 사람(들)의 이름과 주소를 입력합니다. 예:
>mail jan@brown
다음이 나옵니다.
Subject:
- 메시지 제목을 입력하고 Enter를 누릅니다. 예:
Subject: Dept Meeting
이제 본문을 입력할 수 있습니다.
- 메시지를 입력합니다. 예:
There will be a short department meeting this afternoon
in my office. Please plan on attending.
- mail 편집기로 입력한 메시지를 보내려면 메시지의 새 줄 맨 앞에서 텍스트 끝 문자(보통 Ctrl-D나 마침표
.)를 누릅니다. Cc: 필드가 나옵니다.
Cc:
- 사본을 받을 사용자의 이름과 주소를 입력합니다. 예:
Cc: karen@hobo cliff@cross
참고: 사본을 보내지 않으려면 아무것도 입력하지 않고 Enter를 누릅니다.
Enter 키를 누르면 메시지가 지정한 주소로 배달됩니다.
참고: 시스템이 모르거나 별칭·배포 목록에 정의되지 않은 주소를 입력하면 로그인 이름 다음에 오류 메시지 [user ID]... User unknown이 나옵니다.
메일에 답하기
메일함 프롬프트에서 r과 R 하위 명령으로 메일에 답합니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- 시스템 메일함에 메일이 있어야 합니다.
| 하위 명령 | 설명 |
|---|---|
r |
고른 메시지를 보낸 사람에게 가고 Cc: 필드의 사람들(있으면)에게 사본이 가는 새 메시지를 만듭니다. 새 메시지의 Subject: 필드는 고른 메시지를 가리킵니다. 기본은 현재 메시지이며, r 뒤에 메시지 번호를 입력해 바꿀 수 있습니다. |
R |
메시지를 보낸 사람에게만 답장을 시작합니다. 기본은 현재 메시지입니다. |
R 4 |
메시지를 보낸 사람에게만 답장을 시작합니다. R 뒤에 메시지 번호를 입력해 현재 메시지 대신 쓸 수 있습니다. 이 예는 메시지 4에 대한 답장을 시작합니다. To: karen@thor Subject: Re: Department Meeting과 비슷한 내용이 나오면 답장(예: I'll be there.)을 입력합니다. 다 입력하면 마침표(.)나 Ctrl-D를 눌러 보냅니다. 답장을 보내면 메일함 프롬프트로 돌아옵니다. |
메일함에서 새 메시지 만들기
메일함 프롬프트에서 m 하위 명령으로 새 메시지를 만듭니다.
| 하위 명령 | 설명 |
|---|---|
m Address |
Address는 올바른 사용자 주소입니다. mail 편집기를 시작해 메일함 안에서 새 메시지를 만들게 합니다. 메시지를 보내면 메일함 프롬프트로 돌아옵니다. |
메일 전달하기
메일을 읽다가 특정 메모를 다른 사용자에게 전달하고 싶을 수 있습니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
- 고른 메시지를 전달하려면 mail 명령으로 메일 기능을 시작하고, 전달할 메일 메시지의 번호를 적어 둡니다.
이 작업은 ~f와 ~m 하위 명령으로 할 수 있습니다.
평소 네트워크 주소를 떠나 있을 때는 .forward 파일을 만들어 메일을 다른 네트워크 주소로 보내게 할 수 있습니다(.forward 파일 참고). 새 주소는 내 네트워크나 연결된 네트워크의 올바른 메일 주소면 됩니다. 내가 없는 동안 메시지를 처리할 동료의 주소일 수도 있습니다. 네트워크 메일을 전달하도록 하면 들어오는 메일의 사본이 내 메일함에 남지 않습니다. 모든 메일이 지정한 주소(들)로 바로 전달됩니다.
메일함에서 고른 메시지 전달하기
메일함 안에서 특정 메일 메시지를 전달하는 절차입니다.
- 메일함 프롬프트에서
m하위 명령으로 새 메시지를 만들고 받는 사람을 지정합니다.
m User @ Host
User는 다른 사용자의 로그인 이름이고 Host는 그 사용자의 시스템 이름입니다. 사용자가 내 시스템에 있으면 주소의 @Host 부분은 빼도 됩니다.
- Subject: 프롬프트에 제목을 입력합니다.
- 전달할 메일 메시지의 번호를 지정하려면 다음을 입력합니다.
~f MessageNumber
또는
~m MessageNumber
MessageNumber는 전달할 메일을 가리킵니다. mail 명령은 다음과 비슷한 메시지를 보여 줍니다.
Interpolating: 1
(continue)
- mail을 끝내려면 빈 줄에 마침표(
.)를 입력합니다. Cc: 프롬프트에 메일 메시지를 함께 전달할 이름을 입력합니다.
모든 메일 전달하기
모든 메일을 다른 사람에게 전달하는 절차입니다.
- 매개변수 없이
cd명령을 입력해 홈 디렉터리에 있는지 확인합니다. 로그인 이름mary라면 예를 들어 다음을 입력합니다.
cd
pwd
다음이 나옵니다.
/home/mary
홈 디렉터리에
.forward파일을 만듭니다(아래 .forward 파일 참고).참고:
.forward파일을 지울 때까지 메일을 받지 못합니다.
.forward 파일
.forward 파일에는 전달된 네트워크 메일을 받을 네트워크 주소(들)가 들어 있습니다.
주소는 User@Host 형식이어야 합니다. User는 다른 사용자의 로그인 이름이고 Host는 그 사용자의 시스템 이름입니다. 사용자가 내 시스템에 있으면 @Host 부분은 빼도 됩니다. cat 명령으로 다음처럼 .forward 파일을 만들 수 있습니다.
cat > .forward
mark
joe@saturn
[END OF FILE]
[END OF FILE]은 파일 끝 문자로, 대부분의 터미널에서 Ctrl-D입니다. 빈 줄에 입력해야 합니다.
.forward 파일에는 메일을 전달받을 사용자의 주소가 들어 있습니다. 이 예에서 메일은 로컬 시스템의 mark와 saturn 시스템의 joe에게 전달됩니다.
이 파일에는 올바른 주소가 있어야 합니다. 빈 파일(길이 0)이면 메일은 전달되지 않고 메일함에 저장됩니다.
참고: .forward 파일을 지울 때까지 메일을 받지 못합니다.
메일 전달 취소하기
메일 전달을 멈추려면 .forward 파일을 지웁니다. rm 명령으로 홈 디렉터리의 .forward 파일을 지웁니다.
rm .forward
휴가 메시지 알림 보내기
휴가 메시지 알림을 준비하고 보내는 절차입니다. mail 프로그램이 시스템에 설치되어 있어야 합니다.
$HOME(로그인) 디렉터리에서 다음을 입력해 휴가 메시지를 초기화합니다.
vacation -I
메시지를 보낸 사람들의 이름을 보관하는 .vacation.dir 파일과 .vacation.pag 파일이 만들어집니다.
.forward파일을 고칩니다. 예를 들어carl은.forward파일에 다음 문을 넣습니다.
carl, |"/usr/bin/vacation carl"
첫 번째 carl은 메일을 전달받을 사용자 이름이고, 두 번째 carl은 휴가 메시지를 보내는 사람의 사용자 이름입니다. 메일을 보낸 사람은 carl에게 메시지를 몇 개 보내든 일주일에 한 번 carl의 휴가 메시지를 받습니다. 메일을 다른 사람에게 전달하게 해 두었다면 보낸 사람의 메일 메시지는 .forward 파일에 정의한 사람에게 전달됩니다. -f 플래그로 메시지를 보내는 간격을 바꿉니다. 예를 들어 carl은 .forward 파일에 다음 문을 넣습니다.
carl, |"/usr/bin/vacation -f10d carl"
그러면 보낸 사람은 carl에게 메시지를 몇 개 보내든 10일에 한 번 carl의 휴가 메시지를 받습니다.
- 메일을 보낸 사람마다 메시지를 보내려면
$HOME/.vacation.msg파일을 만들어 메시지를 넣습니다. 휴가 메시지의 예입니다.
From: [email protected] (Carl Jones)
Subject: I am on vacation.
I am on vacation until October 1. If you have something urgent,
please contact Jim Terry <[email protected]>.
--carl
보낸 사람은 $HOME/.vacation.msg 파일의 메시지를 받으며, 그 파일이 없으면 /usr/share/lib/vacation.def 파일의 기본 메시지를 받습니다. 두 파일이 모두 없으면 메일을 보낸 사람에게 자동 응답을 보내지 않으며 오류 메시지도 만들지 않습니다.
휴가 메시지를 취소하려면 $HOME(로그인) 디렉터리에서 .forward, .vacation.dir, .vacation.pag, .vacation.msg 파일을 지웁니다.
rm .forward .vacation.dir .vacation.pag .vacation.msg
비밀 메일 보내고 받기
비밀 메일을 보내려면 시스템 명령줄 프롬프트에서 xsend 명령을 씁니다.
- mail 프로그램이 시스템에 설치되어 있어야 합니다.
enroll명령으로 암호를 설정해 두어야 합니다.
| 명령 | 설명 |
|---|---|
xsend barbara |
이 예에서 비밀 메일은 로그인 이름 barbara에게 갑니다. Enter를 누르면 한 줄 편집기로 메시지 텍스트를 입력합니다. 다 입력하면 Ctrl-D나 마침표(.)를 눌러 mail 편집기를 끝내고 메시지를 보냅니다. xsend 명령은 보내기 전에 메시지를 암호화합니다. |
- 비밀 메일을 받으려면 시스템 명령줄 프롬프트에서 다음을 입력합니다.
mail
시스템 메일함의 메시지 목록이 나옵니다. 비밀 메일 프로그램은 비밀 메일이 왔다는 알림을 보냅니다. 메시지 줄은 다음과 비슷합니다.
Mail [5.2 UCB] Type ? for help.
"/usr/spool/mail/linda": 4 messages 4 new
>N 1 robert Wed Apr 14 15:23 4/182 "secret mail from robert@Zeus"
메시지 텍스트는 호스트에서 xget 명령으로 비밀 메일을 읽으라고 안내합니다.
- 시스템 명령줄 프롬프트에서 다음을 입력합니다.
xget
앞서 enroll 명령으로 설정한 암호를 묻습니다. 암호를 입력하면 xget 명령 프롬프트가 나오고 비밀 메일 목록이 이어집니다. 비밀 메일은 mail 프로그램으로 표시합니다. 읽은 메시지와 읽지 않은 메시지를 비밀 메일함에 남기고 xget 명령이 메시지를 지우지 않게 하려면 q 하위 명령을 입력해야 합니다.
영어 원문
Creating and sending mail
You can use the mail program to create, send, reply, and forward messages to other users or to send ASCII files to other users.
An ASCII file might, for example, be a document you have written using a preferred editor or a source file for a program.
You can send messages and files to a user on your local system, on your network, or to a user on another connected network. The recipient does not need to be logged on to the system when you send the information. Mail is sent to a user's address.
Addressing mail
Mail is sent to a user's address. The address, containing the login name and system name, directs the delivery of the mail message.
Generally, to send a message to another user, you must enter the mail command and the address as follows:
mail User @ Address
The format of the Address parameter depends upon the location of the recipient. The concept is similar to how you might address a note to a fellow worker in an office. To send a note to Ryan, who works in a small department of six to eight people, you might write the name on an envelope and put it in the office mail system. However, if Ryan is in another department, you might have to provide more information on the envelope:
Ryan
Payroll
If Ryan is in another geographic location, you might need even more information to ensure that the message reaches him:
Ryan
Payroll
Gaithersburg
To send mail electronically, use a similar addressing progression:
- mail
ryan— To send mail to a user on your local system, the login name is the only part of the address required. - mail
ryan@tybalt— To send mail to a user on your local network, enter the full system (node) address. - mail
[email protected]— To send mail to a user on another connected network, enter the full system address and network address. - mail
dept71— You can send mail to a specific group of people by using an alias or distribution list. To do so, you must create an alias or distribution list in your.mailrcfile. If you need information on creating aliases, see “Aliases and distribution lists” on page 37. - Addressing mail to more than one user:
To address mail to more than one user at the same time, separate each user name with a space.
For example:
ryan@tybalt suemc@julius dmorgan@ophelia
Addressing mail to users on your local system:
To send a message to a user on your local system (to someone whose login name is listed in your /etc/passwd file), use the login name for the address.
At your system command line prompt, you can use the mail command shown in the following example:
mail LoginName
- mail
ryan— If Ryan is on your system and has the login nameryan, this command activates the mail program, enables you to create a message, and tries to send the message to a local login name ofryan. If the message is delivered successfully, you receive no notification. If Ryan is not on your system, the mail system immediately returns an error message and returns the unsent message to your system mailbox. - Addressing mail to users on your network:
Use the mail command to send a message to users on your network. Include the user's login name and system name in the address.
To send a message through a local network to a user on another system, at the command line, type:
- mail LoginName@SystemName — For example, if Ryan is on system
zeus, use the following command to create and send a message to him:mail ryan@zeusThis command activates the mail program, enables you to create a message, and tries to send the message to login nameryanon systemzeus. If the message is delivered successfully, you receive the system prompt with no notification. If the mail address is incorrect, you receive an error message. - Note: To send a message through a local network to a user on another system, you must know the
login name and the name of the other system. For more information about displaying information that identifies users, see Communications system commands.
Addressing mail to users on a different network:
If your network is connected to other networks, you can send mail to users on the other networks.
The address parameters differ depending on how your network and the other networks address each other and how they are connected. Depending on how your network configuration, take one of these actions:
- If you are using a central database of names and addresses, use the mail command shown in the following example:
mail LoginName @ SystemName
If the networks use a central database of names, you do not need any additional information to send mail to users on the connected networks. Use the same addressing format as for users on your local network. This type of addressing works well when the nature of the network allows a central database of names to be maintained.
- If your network uses domain name addressing, use the mail command shown in the following example:
mail LoginName @ SystemName . DomainName
For networks that span large, unrelated networks in widespread locations, a central database of names is not possible. The DomainName parameter defines the remote network, relative to your local network, within the defined structure for the larger group of interconnected networks. For example, if you enter the following command:
mail [email protected]
your mail is sent to user kelly on the system merlin, which is on a local network named odin that is connected to a second network whose domain is called valryanl.
Mail addresses over a BNU or UUCP link:
You can send messages to users on another system over a Basic Networking Utilities (BNU) or UNIX-to-UNIX Copy Program (UUCP) link.
To send a message to a user on another system connected to your system by the BNU or another version of UUCP, you must know:
The login name
The name of the other system
The physical route to that other system
The person responsible for connecting your system to other systems should be able to provide routing information to address the other system.
When Your Computer Has a BNU or UUCP Link: At your system command line prompt, use the mail command as shown in the following examples:
- mail
UUCPRoute!LoginName— If your local computer has a BNU or UUCP connection that can be used to reach the remote system, use the format in this example to address a message. The variable LoginName is the login name on the remote system for the message recipient. The variable UUCPRoute describes the physical route the message must follow along the UUCP network. If your system is connected to the remote system without any intermediate UUCP systems between, this variable is the name of the remote system. - mail
arthur!lancelot!merlin!ken— If your message must travel through one or more intermediate UUCP systems before reaching the desired remote system, this variable is a list of each of the intermediate systems. The list starts with the nearest system and proceeds to the farthest system, separated by an exclamation mark (!). You can follow this example, if the message must travel through systemsarthurandlancelot(in that order) before reachingmerlin. - mail
merlin!ken— If your local system has a UUCP link to a system calledmerlinand there are no other UUCP systems between your system andmerlin, you can send a message tokenon that system. - When the BNU or UUCP Link Is on Another Computer: In a local or wide area network environment,
one of the systems on the network may have a BNU or other type of UUCP connection to a remote system. You can use that UUCP connection to send a message to a user on that remote UUCP system. At your system command line prompt, use the mail command as shown in the following example:
mail @arthur:merlin!ken
Sends mail to ken on UUCP system merlin from the Internet system arthur. The delimiter @ is for the internet addressing, the delimiter ! is for the UUCP addressing, and the delimiter : connects the two addresses. Notice that in this format you are not sending mail to a user at any of the intermediate systems, so no login name precedes the @ in the domain address.
mail @arthur:odin!acct.dept!kelly
Sends mail to kelly on UUCP system acct.dept through system odin from the Internet system arthur.
[email protected]:@dept1.UUCP:@dept2:bill@dept3
Sends mail to bill@dept3 over odin and dept1 UUCP links and then over the local network link between systems dept2 and dept3. The /etc/sendmail.cf file must be configured accordingly to use this type of UUCP address notation. See your system administrator for information.
If you often send mail to users on other networks, creating aliases that include the users' addresses can save you time. See Aliases and distribution lists.
Starting the mail editor
The mail program provides a line-oriented editor for creating messages.
The mail program must be installed on your system.
The mail program must be started.
This editor enables you to type each line of the message, press the Enter key to get a new line, and type more text. You cannot change a line after you have pressed the Enter key. However, before pressing the Enter key, you can change information on that one line by using the Backspace and Delete keys to erase. You can also use mail editor subcommands to enter a full-screen editor and change the message.
When you create mail with the mail editor, the date: and from: fields are automatically completed by the system. You have the option to complete the subject: and cc: fields. These fields are similar to the body of a standard business letter.
The mail editor includes many control subcommands that enable you to perform other operations on a message. Each of these subcommands must be entered on a new line and must begin with the special escape character. By default, the escape character is a tilde (~). You can change it to any other character by including the set escape option in your .mailrc file.
At your system command line prompt or your mailbox prompt, you can use the mail command as shown in the following examples:
- mail
User@Address— Issue this command from the command line prompt. The message is addressed to User@Address. The Address parameter depends upon the location of the recipient. - m
User@Address— Issue this subcommand from the mailbox prompt. The message is addressed to User@Address. The Address parameter depends upon the location of the recipient.
The mail editor is also activated, if you use the R or r subcommands to reply to a message. For more information on how to reply to a message, see Sending mail and Replying to mail.
Message editing
While in your mailbox, you can add information to an existing message by typing the (e)dit or (v)isual subcommand at the mailbox prompt.
While in the mail editor, you cannot change information on a line after you have pressed the Enter key and gone on to the next line. You can change the content of your message before sending it by editing the message with another editor.
Before editing a message in another editor, make sure the following conditions are true:
The mail program must be installed on your system.
The alternate editor must be defined in the
.mailrcfile with:
set EDITOR= PathName
This defines the editor you activate with the ~e subcommand. The value of PathName must be the full path name to the editor program that you want to use. For example, the definition set EDITOR=/usr/bin/vi defines the vi editor for use with the ~e subcommand.
To add information to a message in your mailbox, you must have started the mail command to read mail in the system mailbox, other mailbox, or folder.
To start an alternate editor while creating a message, you must be in the mail editor prompt.
Adding information to a specific message in your mailbox:
To add information to a message in your mailbox, enter the e subcommand or the v subcommand, followed by the message number.
At the mailbox prompt, you can use either the e subcommand or the v subcommand as shown in the following examples:
- e
13— To add a note to message13using the e editor (or whatever editor is defined in the.mailrcfile). - v
15— To add a note to message15using the vi editor (or whatever editor is defined in the.mailrcfile).
If you do not specify a message number, the mail command activates the editor using the current message. When you leave the editor, you return to the mailbox prompt to continue processing the messages in the mailbox.
Changing the current message while in the mail editor:
At the beginning of a line while in the mail editor, you can use either the ~e subcommand or the ~v subcommand as shown in these examples.
- ~e — Activates the e editor or other editor that you define in the
.mailrcfile. - ~v — Activates the vi editor or other editor that you define in the
.mailrcfile.
This enables you to edit the text of the current message. When you leave the different editor, you return to the mail editor.
Displaying lines of a message while in the mail editor:
Use the ~p subcommand to display message lines while in the mail editor.
The mail program must be installed on your system.
To display a message while in the mail editor, you must have started the mail editor. If you need information on this, see Starting the mail editor.
At the beginning of a line while in the mail editor, use the ~p subcommand as shown in the following example:
- ~p — The editor displays the contents of the message including the header information for the message. The text scrolls up from the bottom of the display. The end of the message is followed by the mail editor's
(Continue)prompt.
If the message is larger than one screen and you have not set the page size for your terminal by using the stty command, the text scrolls off the top of the screen to the end. To look at the content of large messages, use the mail editor subcommands to view the message with another editor. If you need information on this, see Message editing.
Quitting the mail editor
To quit the mail editor without sending the message, use the ~q subcommand or the interrupt key sequence (usually the Alt-Pause or Ctrl-C key sequence).
The mail program must be installed on your system.
To display a message while in the mail editor, you must have started the mail editor. If you need information on this, see Starting the mail editor.
If you have entered any text, the mail command saves the message in the dead.letter file.
At the beginning of a line while in the mail editor, you can use the ~q subcommand as shown in the following example:
- ~q — Quits the mail editor and the message is not sent. The message is saved in the
dead.letterfile in your home directory, unless you have not entered any text. The system prompt is displayed. - Ctrl-C — To quit the editor using an interrupt key sequence, press the break (Ctrl-C key sequence) or the interrupt (Alt-Pause key sequence). The following message is displayed:
(Interrupt -- one more to kill letter)Press break or interrupt again.(Last Interrupt -- letter saved in dead.letter)The message is not sent. The message is saved in thedead.letterfile in your home directory, unless you have not entered any text. The system prompt is displayed. - Note: When you exit the mail editor without sending the message, the previous content of the
dead.letterfile is replaced with the incomplete message. To retrieve the file, see “Options for
adding a file and a specific message within a message.”
Options for adding a file and a specific message within a message:
Several requirements must be met before adding a file and specific message within a mail message.
Prerequisites
The mail program must be installed on your system.
You must know the name and address of the mail recipient.
The mail editor must be started.
Including files in a message:
Use the ~r subcommand to add files to a message.
At the beginning of a line while in the mail editor, you can use the ~r subcommand as shown in the following example:
- ~r
schedule— Wherescheduleis the name of the file to include. In this example, the information in the filescheduleis included at the current end of the message being written. - Including a specific message within a message:
Use the ~f or ~m subcommand to include a specific message within your message.
At the beginning of a new line while in the mail editor, you can use either the ~f or ~m subcommand as shown in the following examples:
- ~f
MessageList— Appends the indicated message or messages to the end of the current message, but does not indent the appended message. Also, use this subcommand to append messages for reference whose margins are too wide to embed with the ~m subcommand. Note: The parameter MessageList is a list of integers that refer to valid message numbers in the mailbox or folder being handled by mail. You can enter simple ranges of numbers also. For example: ~f1-4Appends messages 1, 2, 3, and 4 to the end of the message being written. These messages are aligned with the left margin (not indented). - ~m
2— Appends the indicated message to the end of the current message. The included message is indented one tab character from the normal left margin of the message. In this example, message 2 is appended to the current message. - ~m
1 3— Appends message 1 and then message 3 to the end of the message being written, indented one tab from the left margin. - Adding the contents of the dead.letter file into your current message:
Use the ~d subcommand to add dead.letter contents to your message.
At the beginning of a new line while in the mail editor, you can use the ~d subcommand as shown in the following example:
- ~d — Retrieves and appends the contents of the
dead.letterfile to the end of the current message. At the(Continue)prompt, continue by adding to the message or by sending the message.
Editing the header information
The header of a message contains routing information and a short statement of the subject. You must specify at least one recipient of the message.
The mail program must be installed on your system.
Start the mail editor and begin editing a message. For more information, seeStart the mail editor.
The rest of the header information is not required. The information in the header can include the following:
- To: — Contains the address or addresses for sending the message.
- Subject: — Contains a short summary of the topic of the message.
- Cc: — Contains the address or addresses for sending copies of the message. The contents of this field are part of the message sent to all who receive the message.
- Bcc: — Contains the address or addresses for sending blind copies of the message. This field is not included as part of the message sent to all who receive the message.
You can customize the mail program to automatically ask for the information in these fields by putting entries in your .mailrc file. For more information, see Mail program customization options.
Setting or resetting the Subject: field:
Use the ~s subcommand to set the Subject: field to a particular phrase or sentence.
Using this subcommand replaces the previous contents (if any) of the Subject: field. At the beginning of a new line while in the mail editor, you can use the ~s subcommand as shown in the following example:
- ~s
Fishing Trip— This changes the current Subject: field:Subject: VacationTo the following:Subject: Fishing TripNote: You cannot append to the Subject: field with this subcommand. Use the ~h subcommand, as described in “Editing the header information.” - Adding users to the To:, Cc:, and Bcc: fields:
Use the ~t, ~c, or the ~b subcommand to add users to the header fields.
At the beginning of a new line while in the mail editor, you can use the ~t, ~c , or ~b subcommands as shown in the following examples:
- ~t
geo@austin mel@gtwn— This changes the current To: field:To: mark@austinto the following:To: mark@austin geo@austin mel@gtwn - ~c
geo@austin mel@gtwn— This changes the current Cc: field:Cc: mark@austin amyto the following:Cc: mark@austin amy geo@austin mel@gtwn - ~b
geo@austin mel@gtwn— This changes the current Bcc: field:Bcc: mark@austinto the following:Bcc: mark@austin geo@austin mel@gtwn - Note: You cannot use the ~t, ~c, or ~b subcommands to change or delete the contents of the To:, Cc:, and Bcc: fields. Use the ~h subcommand, as described in “Editing the header information” on
page 28.
Message reformats in the mail editor
After typing the message and before sending it, you can reformat the message to improve its appearance by using the fmt shell program.
Before reformatting a message, make sure the following conditions are true:
The mail program must be installed on your system.
The fmt command must be installed on your system.
At the beginning of a new line while in the mail editor, you can use the fmt command as shown in the following example:
~|fmt — Changes the appearance of the message by re-flowing the information for each paragraph within defined margins (a blank line must separate each paragraph). The pipe (|) subcommand pipes the message to standard input of the command and replaces the message with the standard output from that command.- Attention: Do not use the fmt command if the message contains embedded messages or
pre-formatted information from external files. The fmt command reformats the header information in embedded messages and may change the format of pre-formatted information. Instead, use the ~e or ~v subcommand to enter a full-screen editor and reformat the message.
Checking for misspelling in the mail editor
The spell command checks the spelling in your message.
Before checking a message for misspellings, make sure the following conditions are true:
The mail program must be installed on your system.
The text-formatting programs must be installed on your system.
Use the spell command to check your message for misspelled words, from the mail editor:
- Write the message to a temporary file. For example, to write the message to the
checkitfile, type:
~w checkit
- Run the spell command using the temporary file as input. Type:
~! spell checkit
In this example, the exclamation point (!) is the subcommand that starts a shell, runs a command, and returns to the mailbox. The spell command responds with a list of words that are not in its list of known words, followed by an exclamation point (!) to indicate that you have returned to the mail program.
Examine the list of words. Determine if you need to use an editor to make corrections.
Type the following to delete the temporary file:
~! rm checkit
Sending mail
Use this procedure to send a message after you have created it.
The mail program must be installed on your system.
You must know the name and address of the mail recipient.
- Enter the mail command on the command line, followed by the name and address of the recipient (or recipients) of the message. For example:
>mail jan@brown
The system responds with:
Subject:
- Type the subject of the message. For example:
Subject: Dept Meeting
and press Enter. You can now type the body of the text.
- Type your message. For example:
There will be a short department meeting this afternoon
in my office. Please plan on attending.
- To send a message you have typed with the mail editor, press the end-of-text character, which is usually the Ctrl-D key sequence or a period (
.), while at the beginning of a new line in the message. The system displays the Cc: field:
Cc:
- Type the names and addresses of those users who should receive copies of the message. For example:
Cc: karen@hobo cliff@cross
Note: If you do not want to send copies, press Enter without typing.
When you press the Enter key, the message is delivered to the specified address.
Note: If you enter an address unknown to the system, or not defined in an alias or distribution list, the system responds with the login name followed by an error message: [user ID]... User unknown.
Replying to mail
At the mailbox prompt, you can use the r and R subcommands to reply to mail as shown in the following examples.
The mail program must be installed on your system.
There must be mail in your system mailbox.
- r — Creates a new message that is addressed to the sender of the selected message and copied to the people in the Cc: field (if any). The Subject: field of the new message refers to the selected message. The default value of the r subcommand is the current message. This default can be overridden by typing the message number after the r.
- R — Starts a reply only to the sender of the message. The default value of the R subcommand is the current message.
- R
4— Starts a reply only to the sender of the message. You can override the current message by typing the message number after the R. This example starts a reply to message 4. The system responds with a message similar to the following:To: karen@thor Subject: Re: Department MeetingYou then can type your response:I’ll be there.When you finish typing the text, press either the period (.) or the Ctrl-D key sequence to send the message. After the reply is sent, you are returned to the mailbox prompt.
Creating a new message while in the mailbox
At the mailbox prompt, you can use the m subcommand as shown in the following example to create new messages.
- m Address — The Address parameter is any correct user address. This subcommand starts the mail editor and enables you to create a new message while in the mailbox. When you send the message, you will be returned to the mailbox prompt.
Forwarding mail
While reading your mail, you might want to forward a specific note to another user.
The mail program must be installed on your system.
If forwarding a selected message, start the mail facility with the mail command. Make a note of the number of the mail message that you wish to forward.
This task can be accomplished by using the ~f and ~m subcommands.
If you are going to be away from your normal network address, you can have your mail sent to another network address by creating the .forward file. See .forward files. The new address can be any valid mail address on your network or a network connected to yours. It can be the address of a coworker who will handle your messages while you are away. When you choose to forward your network mail, you do not receive a copy of any incoming mail in your mailbox. All mail is forwarded directly to the address or addresses that you have specified.
Forwarding selected messages from within the mailbox:
Use this procedure to forward specific mail messages within the mailbox.
To forward specific mail messages:
- Create a new message by using the m subcommand and specify a recipient by typing the following at the mailbox prompt:
m User @ Host
where User refers to the login name of another user, and Host is the name of the user's system. If the user is on your system, you can omit the @Host part of the address.
Type a subject name at the Subject: prompt.
To specify the number of the mail message to be forwarded, type:
~f MessageNumber
OR
~m MessageNumber
MessageNumber identifies the piece of mail to forward. The mail command displays a message similar to the following:
Interpolating: 1
(continue)
- To exit mail, type a period (
.) on a blank line. At the Cc: prompt, type any additional names to whom you wish to forward a mail message.
Forwarding all mail:
Use this procedure to forward all of your mail to another person.
To forward all your mail to another person:
- Enter the cd command with no parameters to ensure you are in your home directory. For example, type the following for login name
mary:
cd
pwd
The system responds with:
/home/mary
- Create a
.forwardfile in your home directory. See “.forward files.”
Note: You will not receive any mail until you delete the .forward file.
.forward files:
The .forward file contains the network address or addresses that will receive your forwarded network mail.
Addresses must take the form of User@Host. User refers to the login name of another user, and Host is the name of the user's system. If the user is on your system, you can omit the @Host part of the address. You can use the cat command to create a .forward file as follows:
cat > .forward
mark
joe@saturn
[END OF FILE]
[END OF FILE] represents the end of file character, which is the Ctrl-D key sequence on most terminals. This must be typed on a blank line.
The .forward file contains the addresses of the users you want your mail forwarded to. Your mail will be forwarded to mark on your local system, and to joe on system saturn.
This file must contain valid addresses. If it is a null file (zero length), your mail is not forwarded and is stored in your mailbox.
Note: You will not receive any mail until you delete the .forward file.
Canceling forwarded mail:
To stop forwarding mail, delete the .forward file as follows.
Use the rm command to remove the .forward file from your home directory:
rm .forward
Sending a vacation message notice
Use this procedure to prepare and send a vacation message notice.
The mail program must be installed on your system.
- Initialize the vacation message in your
$HOME(login) directory by typing:
vacation -I
This creates a .vacation.dir file and a .vacation.pag file where names of the people who send messages are kept.
- Modify the
.forwardfile. For example,carltypes the following statement in the.forwardfile:
carl, |"/usr/bin/vacation carl"
The first carl entry is the user name to which mail is forwarded. The second carl entry is the user name of the sender of the vacation message. The sender of the mail message receives one vacation message from carl per week, regardless of how many messages are sent to carl from the sender. If you have your mail forwarded to someone else, the mail message from the sender is forwarded to the person defined in your .forward file. Use the -f flag to change the frequency intervals at which the message is sent. For example, carl types the following statement in the .forward file:
carl, |"/usr/bin/vacation -f10d carl"
The sender of mail messages receives one vacation message from carl every ten days, regardless of how many messages are sent to carl from the sender.
- To send a message to each person who sends you mail, create the file
$HOME/.vacation.msgand add your message to this file. The following is an example of a vacation message:
From: [email protected] (Carl Jones)
Subject: I am on vacation.
I am on vacation until October 1. If you have something urgent,
please contact Jim Terry <[email protected]>.
--carl
The sender receives the message that is in the $HOME/.vacation.msg file, or if the file does not exist, the sender receives the default message found in the /usr/share/lib/vacation.def file. If neither of these files exists, no automatic replies are sent to the sender of the mail message, and no error message is generated.
To cancel the vacation message, remove the .forward file, .vacation.dir file, .vacation.pag file, and .vacation.msg file from your $HOME (login) directory as follows:
rm .forward .vacation.dir .vacation.pag .vacation.msg
Sending and receiving secret mail
To send secret mail, at the system command line prompt, use the xsend command in the way shown in the following example.
The mail program must be installed on your system.
A password must have been set up using the enroll command.
- xsend
barbara— In this example, secret mail is being addressed to the login namebarbara. When you press Enter, a single line editor is used to type the text of the message. When you are finished typing your message, press the Ctrl-D key sequence or a period (.) to exit the mail editor and send the message. The xsend command encrypts the message before it is sent.
- To receive secret mail, at your system command line prompt, type:
mail
The system displays the list of messages in your system mailbox. The secret mail program sends you a notification that you have received secret mail. The message line will be similar to the following:
Mail [5.2 UCB] Type ? for help.
"/usr/spool/mail/linda": 4 messages 4 new
>N 1 robert Wed Apr 14 15:23 4/182 "secret mail from robert@Zeus"
The message text directs you to read your secret mail on your host using the xget command.
- At the system command line prompt, type:
xget
You are prompted for the password that was previously set up using the enroll command. After you type your password, the xget command prompt is displayed, followed by a listing of any secret mail. The mail program is used to display any secret mail. You must enter the q subcommand if you want to leave read and unread messages in the secret mailbox and prevent the xget command from deleting the messages.
관련 글: 메일 (1), 메일 (3), 메일 (4) sendmail 관리