Network

SMTP Protocol

In this tutorial, we are going to see What is the SMTP Protocol? E-mail is considered to be the most used service on the Internet. Thus the TCP/IP protocol suite offers a wide range of protocols to easily manage mail routing on the network.
 

 

SMTP Protocol

SMTP (Simple Mail Transfer Protocol) is the standard protocol for transferring mail from one server to another in a point-to-point connection.

It is a protocol that works in connected mode, encapsulated in a TCP/IP frame. The mail is delivered directly to the recipient’s mail server. The SMTP protocol works by sending text commands to the SMTP server (by default on port 25). Each command sent by the client (validated by the ASCII string CR/LF, equivalent to pressing the enter key) is followed by a response from the SMTP server made of a number and a descriptive message.

Here is a scenario of a request to send mail to an SMTP server:
 


 
 

  • When opening the SMTP session, the first command to send is the HELO command followed by a space (noted <sp>) and the domain name of your machine (in order to say “hello”), then validate with enter (noted <crlf>). Since April 2001, the SMTP protocol specifications, defined in RFC 2821, require that the HELO command be replaced by the EHLO command.
  • The second command is “MAIL FROM:” followed by the sender’s email address. If the command is accepted the server returns the message “250 OK”.
  • The next command is “RCPT TO:” followed by the recipient’s email address. If the command is accepted the server returns the message “250 OK”.
  • The DATA command is the third step of the sending process. It announces the beginning of the message body. If the command is accepted, the server returns an intermediate message numbered 354 indicating that the sending of the body of the email can begin and considers all the following lines until the end of the message marked by a line containing only a dot. The body of the mail may contain some of the following headers:
    • Date
    • Subject
    • Cc
    • Bcc
    • From
  • If the command is accepted the server returns the message “250 OK”.
 
Here is an example of a transaction between a client (C) and an SMTP server (S)

S: 220 smtp.stackhowto.com SMTP Ready
C: EHLO user1.stackhowto.com
S: 250 smtp.stackhowto.com
C: MAIL FROM:<[email protected]>

S: 250 OK
C: RCPT TO:<[email protected]>

S: 250 OK
C: RCPT TO:<[email protected]>

S: 550 No such user here
C: DATA
S: 354 Start mail input; end with <crlf>.<crlf>

C: Subject: Simple message
C: Hello Jean,
C: How are you?
C :
C: Goodbye!
C: <crlf>.<crlf>

S: 250 OK
C: QUIT
R: 221 smtp.stackhowto.com closing transmission

It is also possible to send a mail with simple telnet on port 25 of the SMTP server:

telnet smtp.stackhowto.com 25

 
mcq-networking-question-answerComputer Network MCQ – Questions and Answers – Part 1Networking MCQs questions with answers to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are…Read More

Leave a Reply

Your email address will not be published. Required fields are marked *