간이 우편 전송 프로토콜

위키백과, 우리 모두의 백과사전.

간이 전자 우편 전송 프로토콜(Simple Mail Transfer Protocol, SMTP)은 인터넷에서 이메일을 보내기 위해 이용되는 프로토콜이다. 사용하는 TCP 포트번호는 25번이다. 상대 서버를 지시하기 위해서 DNS의 MX레코드가 사용된다. RFC2821에 따라 규정되어 있다. 메일 서버간의 송수신뿐만 아니라, 메일 클라이언트에서 메일 서버로 메일을 보낼 때에도 사용되는 경우가 많다.

SMTP는 텍스트 기반의 프로토콜로서 요구/응답 메시지뿐 아니라 모든 문자가 7bit ASCII로 되어있어야 한다고 규정되어 있다. 이 때문에 문자 표현에 8비트 이상의 코드를 사용하는 언어나 첨부파일과 자주 사용되는 각종 바이너리는 마임(MIME)이라고 불리는 방식으로 7비트로 변환되어 전달된다.

SMTP는 메시지를 생성하는 방법을 규정하지 않는다. 메시지 생성을 위하여 로컬 편집이나 단순한 전자 우편 응용이 사용된다. 메시지가 생성되면 호출된 SMTP가 메시지를 받고 TCP를 이용하여 다른 호스트의 SMTP에게 전달한다.

프로토콜 개요[편집]

Connected: An Overview Archived 2013년 2월 10일 - 웨이백 머신(영문)에서 SMTP의 개요에 대해 설명하고 있다.

SMTP는 명령 문자를 제출하고 필요한 데이터를 미더운 데이터 스트림 채널(일반적으로 TCP)을 통해 제공함으로써, 메일을 보내는 이가 메일 수신자와 통신하는 연결 지향 텍스트 기반 프로토콜이다.

  1. MAIL 명령: 주소 반환 확립
  2. RCPT 명령: 메시지 수신자 확립
  3. DATA 명령: 메시지 텍스트의 첫 신호를 제공

SMTP 통신의 예[편집]

메일을 보내는 송신자(클라이언트)와 메일을 받는 수신자(서버)간의 연결이 성립된 후 이루어지는 합법적인 SMTP 세션은 다음과 같다. 아래 대화과정에서 클라이언트가 보내는 메시지는 "C:"를 맨 앞에 써서, 서버가 보내는 메시지는 "S:"를 맨 앞에 써서 표시하기로 하자. 대부분의 컴퓨터 시스템에서 연결은 다음과 같이 텔넷 명령어를 사용하여 만들 수 있다.

telnet www.example.com 25

이 명령으로 보내는 클라이언트에서 호스트인 www.example.com으로 SMTP 연결이 시작될 수 있다.

S: 220 smtp.example.com ESMTP Postfix
C: HELO relay.example.com
S: 250 smtp.example.com, I am glad to meet you
C: MAIL FROM:<bob@example.com>
S: 250 Ok
C: RCPT TO:<alice@example.com>
S: 250 Ok
C: RCPT TO:<theboss@example.com>
S: 250 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: "Bob Example" <bob@example.com>
C: To: Alice Example <alice@example.com>
C: Cc: theboss@example.com
C: Date: Tue, 15 January 2008 16:02:43 -0500
C: Subject: Test message
C: 
C: Hello Alice.
C: This is a test message with 5 header fields and 4 lines in the message body.
C: Your friend,
C: Bob
C: .
S: 250 Ok: queued as 12345
C: QUIT
S: 221 Bye
{The server closes the connection}

SMTP에서의 인증[편집]

원래는 사용자 인증절차가 규정되지 않았었지만, 인터넷의 보급과 함께 그 필요성이 요구되어, SASL 메커니즘을 이용한 인증기구가 SMTP-AUTH(SMTP Authentication)으로 표준화되었다. 인증방식으로 PLAIN, LOGIN, DIGEST-MD5, CRAM-MD5 등이 널리 이용되고 있다.

또, SMTP-AUTH 표준화 이전에 POP_before_SMTP로 불리는 SMTP 밖의 기구에 의한 사용자 제한방법이 고안되어 현재까지 사용되고 있다.

RFC[편집]

  • RFC 1123 – Requirements for Internet Hosts—Application and Support (STD 3)
  • RFC 1870 – SMTP Service Extension for Message Size Declaration (оbsoletes: RFC 1653)
  • RFC 2505 – Anti-Spam Recommendations for SMTP MTAs (BCP 30)
  • RFC 2920 – SMTP Service Extension for Command Pipelining (STD 60)
  • RFC 3030 – SMTP Service Extensions for Transmission of Large and Binary MIME Messages
  • RFC 3207 – SMTP Service Extension for Secure SMTP over Transport Layer Security (obsoletes RFC 2487)
  • RFC 3461 – SMTP Service Extension for Delivery Status Notifications (obsoletes RFC 1891)
  • RFC 3463 – Enhanced Status Codes for SMTP (obsoletes RFC 1893, updated by RFC 5248)
  • RFC 3464 – An Extensible Message Format for Delivery Status Notifications (obsoletes RFC 1894)
  • RFC 3798 – Message Disposition Notification (updates RFC 3461)
  • RFC 3834 – Recommendations for Automatic Responses to Electronic Mail
  • RFC 4952 – Overview and Framework for Internationalized Email (updated by RFC 5336)
  • RFC 4954 – SMTP Service Extension for Authentication (obsoletes RFC 2554, updates RFC 3463, updated by RFC 5248)
  • RFC 5068 – Email Submission Operations: Access and Accountability Requirements (BCP 134)
  • RFC 5248 – A Registry for SMTP Enhanced Mail System Status Codes (BCP 138) (updates RFC 3463)
  • RFC 5321 – The Simple Mail Transfer Protocol (obsoletes RFC 821 aka STD 10, RFC 974, RFC 1869, RFC 2821, updates RFC 1123)
  • RFC 5322 – Internet Message Format (obsoletes RFC 822 aka STD 11, and RFC 2822)
  • RFC 5504 – Downgrading Mechanism for Email Address Internationalization
  • RFC 6409 – Message Submission for Mail (STD 72) (obsoletes RFC 4409, RFC 2476)
  • RFC 6522 – The Multipart/Report Content Type for the Reporting of Mail System Administrative Messages (obsoletes RFC 3462, and in turn RFC 1892)
  • RFC 6531 – SMTP Extension for Internationalized Email Addresses (updates RFC 2821, RFC 2822, RFC 4952, and RFC 5336)

참고 문헌[편집]