SMTP (Simple Mail Transfer Protocol) | POP3 (Post Office Protocol)

Whenever you send a piece of email, your email client interacts with the SMTP Server to handle the sending.
When you compose a message and press the send button, here is what happens:-
  1. Outlook Express (SMTP client) connects to the SMTP server at mail.howstuffworks.com using port 25
  2. Outlook Express has a conversation with the SMTP server, telling the SMTP server the address of the sender and the address of the recipient, as well as the body of the message
  3. The SMTP server takes the "to" address (jsmith@mindspring.com) and breaks it into two parts:
    • The recipient name (jsmith)
    • The domain name (mindspring.com)
  4. If the "to" address has been another user at howstuffworks.com, the SMTP server would simply hand the message to the POP3 server for howstuffworks.com(using a little program called the delivery agent). Since the recipient is at other domain, SMTP needs to communicate with that domain
    1. The SMTP server has a conversation witha Domain Name Server, It says " Can you give me the IP address of the SMTP server for mindspring.com?
      The DNS replies with the one or more IP addtrsesses for teh SMTP server(s) that MindSpring operates
    2. The SMTP server at howstuffworks.com connects withe the SMTP serevr at mindspring using port 25. It has the simple text conversation. It has sthe same sipkle etxt converstaion taht my email client had woth the SMTP server for HOwSTuffWorks, and give sthe message to teh MindSpring server. TheMindSpring SMTP server recognizes the domain name for jsmith is at MindSpring, so it hands the message to mindsoring's POP3 sevr, qwhich puts the message in jsmith's mail box

    Post Office Protocol

    The POst Office Protocol (POP3) server host starts teh POP3 service by listening on TCP port 100. A client establishes aTCP connection with a server host. Then the client and the serevr exchange commmands and responses until the connection is closed or aborted The server can repsond with a positive status sending "+OK" to tye client or with a negative status sending "-ERR" to the client (both in uppercase) A POP3 session progresses through several stages during its lifetime
    1. The Authorization state

      • Once the TCP connection has been opened by the client, the server issues a greeting message starting with a positive response "+OK". Then the client has two possibilities:- sending a username and a password by USER and PASS commands or sending an encrypred password by the APOP command
      • After verifying the identity of the client, the server acquires an exclusive access lock on the mail drop (in order to avoid message deletin before entering the update state). If the lock is not acquired, the server responds with a negative status and may close the connection or stay in the Authorization state in order to allow issuing new authentication commands
      • After the lock is acquired, the server assigns each message a message_number (starting with 1)
      The commands allowed in the Authorization state are:-
      • USER name :- The client issues the USER command with the 'name' string whihc identifies the mailbox the client wishes to access
      • PASS password:- The client issues teh PASS command immediately after the USER command
      • APOP name digest:- The APOP command is based on the MD5 algoirithm. The client issues this command with its username string and a 'digest' string
      • QUIT:- The client can always issue the QUIT command. The server then repsonds woith a posiitve status and closes teh connection
    2. The Transaction state

      After the client has successfully identified itself to the server, the server enters the TRansaction astate. Now the client may issue the below mentioned commands and get reponses from the server to each command. At last client issues a QUIT command and the server enters the Update State

      List of commands

      • STAT:- The server respomnds with a positive status folowed by a single space,the number of meeasfges in the mailbox , another ingle spACE and the size of the mailbox in octets
      • LIST [msg]:-
        1. If an argument is given, the server responds with a positive status followed by a single space, the message number, another single space and the size of the message in octets. In case there is no message number in msg , the server returns a negative status
        2. If not argument is provided , the the server issues a positive status line and then the response given is multi-line
        3. For each message in the message(not marked as deleted) the servber respnds with the line equal to the one issued in the above case. Each, line is treminated witha CR folloed by LN
        4. The last line is a "," chracter followed by a CRLF
      • RET [msg] :- If message number in msg exists the n the server repsonds woth a positive status and then sends the message and a ending line represneted by "." character and a CRLF (Carriage Return Line Feed) else it returns a negative status
      • DEL n [msg]:- The server marks the message numbered in msg as deleted (but does not delete it) and returns a positive status. If no message is numbered in msg then the server reponds with a negative status
      • NOOP:- This command causes nthing but a positigve response form the server
      • ISET:- If any message was marked as deleted nbyt he server, their unmarked.The server reposnds with apositive status
      • QUIT:- The server reposnds with a positive status and enters the update state
      • TOP msg n:- If a messgae numbered in msg exusts than the server responds with a positive status and then sends teh dheaders of the message and the first first n lines of the msg, finally terminate the multi-line transaction as seen in LIST. Else the server returns a negative response
      • Note that if the message has no more than n lines, the whole message is sent.
      • UIDL [msg]:- If a parameter is provided, then the server sends a positive status( if a message numbered in msg exists) followed by a single space and the unique-id listing of the message

Comments

Popular posts from this blog

Parallel Database design, query processing

Laravel | PHP | Basics | Part 2

Apache Hadoop | Running MapReduce Jobs