What is SMTP?

71 Views
English
#SMPT#email#protocol

SpringBoot에서 SMTP를 활용한 메일 전송 구현하기

Outline

Simple Mail Transfer Protocol

It is a network protocol used to transmit email.

SMTP를 알아보자

 

Particular

This is the standard used for sending emails over the Internet. It was standardized in 1982 in RFC821 and was updated in 2008 to ESMTP (Extended SMTP), currently defined in RFC5321. SMTP is often not used as is due to security and compatibility issues. Commonly used extensions include SMTP-AUTH (Sender Authentication Service), ESMTP (Secure Connection using SASL), and MIME (Non-ASCII Data Transfer Format).

SMTP uses ports 25/TCP and 587/TCP, while SMPTS uses port 465/TCP.

SMTP is a connection-oriented, text-based protocol. An SMTP session is created between an SMTP client and an SMTP server, and emails are sent and received using the command line. SMTP exchanges are performed using the following three commands:

  1. MAIL command: Specifies the recipient.
  2. RCPT command: Specifies the sender.
  3. DATA command: The beginning of the message content. It consists of a message header and body.

 

Example

S: 220 smtp.example.com ESMTP Postfix
C: HELO relay.example.org
S: 250 Hello relay.example.org, I am glad to meet you
C: MAIL FROM:<bob@example.org>
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.org>
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}

Each programming language supports libraries for SMTP. Python, for example, has a built-in smtplib library and supports SSL/TLS authentication, allowing users to use Gmail. However, account information and passwords are exposed in scripts, so caution is required for security.

 

Related Posts