SMTP stands for Simple Mail Transfer Protocol.
• This protocol is designed to exchange the file (called e-mails) between two mail servers.
• The sending server pushes the mails to the receiving server. So, it is a push protocol.
• SMTP message body should be in a 7-bit ASCII (American Standard Code for Information Interchange) format.
Format of the SMTP Message format:
S: 220 samplewebsite.edu
C: Hello Amelia
S: 250 Amelia please to meet you
C: Mail From
S: 250 firstname.lastname@example.org....sender ok
C: RCPT To: < samplewebsite.edu >
S: 250 email@example.com....Recipient ok
S: 354 Enter mal, end with “.” On a line by itself
S: 250 Message accepted for delivery
S: 221 samplewebsite.edu closing connection
The end of the message body is indicated by a period (‘.’). The line in the message body containing period at end indicates the message body.
Therefore, SMTP uses period (‘.’) to mark the end of the message body.
HTTP stands for Hypertext Transfer Protocol.
• It is designed to exchange the files (called objects) between client and server.
• The client requests the server for the required files. So, it is a pull protocol.
• For data transfer, there is no restriction on the format of the message body.
• There is no specific mark for the end of the message body in the HTTP protocol.
• Message body indicates the request or response of a message.
• It uses a field called “Content-Length header field” to indicate the length of the message body.
• Content header length indicates the length of the message and it represents a decimal value.
Content-Length: 1234 Content length refers the length of the message body.
Therefore, HTTP uses the “Content-Length header field” to indicate the length of the message body.
Comparison of end marks in HTTP and SMTP:
To mark the end of message body SMTP uses period, whereas HTTP doesn’t have such special marks. It uses “Content-Length header field” for message body length.
There is no specific format for message body in HTTP; it is not possible to use a specific mark like period which is used by SMTP.
Therefore, HTTP and SMTP do not use the same methods to indicate the end of the message body.
Please leave a comment below if you found this answer helpful. Happy learning!