SMTP and POP3





SMTP and POP3:

 ________________________________________

Follow us on Facebook

Follow us on Google+

________________________________________




What is SMTP ?

 

 

The protocol SMTP (Simple Mail Transfer Protocol) is the standard protocol that allows the transfer of mail from one server to another using a point to point connection.This is a protocol that runs on-line, encapsulated in a TCP / IP frame. Mail is sent directly to the recipient's mail server. The SMTP protocol works with text commands sent to the SMTP server (port 25 by default). Each command sent by the client (validated by the ASCII string CR / LF, which is equivalent to pressing the Enter key) followed by an SMTP server response consists of a number and a descriptive message.The following describes a situation in which a request is made for sending mail to an SMTP server:· When opening the SMTP session, the first command is sent HELO command followed by a space (written <SP>) and the domain name of your computer (to say "Hi, this team"), and then validated by Enter (written <CRLF>). Since April 2001, the specifications for the SMTP protocol, defined in RFC 2821, indicate that the HELO command is replaced by the EHLO command.· The second command "MAIL FROM:" followed by the email address of the sender. If the command is accepted, the server responds with a "250 OK".· The next command is "RCPT TO:" followed by the email address of the  



o   Date
o   Subject
o   Cc
o   Bcc
                o   From 

If the command is accepted, the server responds with a "250 OK".

The following describes one example of transaction between a customer (C) and a SMTP server (S):

S: 220 Ready smtp.commentcamarche.net SMTP C: EHLO machine1.commentcamarche.net S: 250 smtp.commentcamarche.net C: MAIL FROM: <webmaster@commentcamarche.net> S: 250 OK C: RCPT TO: <meandus @ meandus.net> S: 250 C: RCPT TO: <tittom@tittom.fr> S: 550 No such user here C: DATA S: 354 Start mail input; End With <CRLF>. <CRLF> C: Subject: Hello C: Hello Meandus: C: How are your things? C: C: See you soon! C: <CRLF>. <CRLF> S: 250 C: QUIT R: 221 smtp.commentcamarche.net closing transmission

The basic specifications of the SMTP protocol indicate that all characters are sent encoded in 7-bit ASCII code and the 8th bit is explicitly zero. Therefore, to send accented characters is necessary to use algorithms that are within specifications MIME:



  base64 for attachments
  Quoted-printable (abbreviated QP) for special characters used in the message body.

Therefore, you can send an email using a simple telnet to port 25 of the SMTP server:

telnet smtp.commentcamarche.net 25

(The above server does not exist. Commentcamarche.net Try replacing the domain name of your Internet service provider.
 



Below is a summary of the main SMTP commands:


A continuación se brinda un resumen de los principales comandos SMTP:

Vommand
Example
Description
HELO (EHLO now
EHLO 193.56.47.125
Identification using the IP address or domain name of the sending computer
MAIL FROM:
MAIL FROM: originator@domain.com
Identification of the sender's address
RCPT TO:
RCPT TO: recipient@domain.com
Identification of the recipient's address
DATA
DATA message
Email body
QUIT
QUIT
SMTP server output
HELP
HELP
List of commands supported by the server SMTP



  All SMTP protocol specifications are defined in RFC 821 (since April 2001, the SMTP protocol specifications are defined in RFC 2821).








What is POP3?

 

The POP (Post Office Protocol), as its name suggests, allows you to collect email on a remote server (POP server). It is necessary for people who are not permanently connected to the Internet, as they can check their e-mails received without them being connected.

There are two main versions of this protocol, POP2 and POP3, which is assigned the ports 109 and 110 respectively, and operate using text commands radically different.

As with SMTP, POP protocol (POP2 and POP3) works with text commands sent to the POP server. Each of these commands sent by the client (validated by the chain CR / LF) consists of a keyword, possibly accompanied by one or more arguments, and is followed by a response from the POP server composed of a number and a descriptive message . 



Below is a summary of the main commands POP2:


Commands POP2
Command  
    Description
HELLO
  Identification using the IP address of the sender
FOLDER
Name inbox to be consulted
READ
Message number to be read
RETRIEVE
Message number to be collected
SAVE
Number of the message is to be stored
DELETE
Number of the message to be deleted
QUIT
POP2 server output


Below is a summary of the main command POP3:

Commands POP2
Command
Description
USER identification
This command enables authentication. Must be followed by the user name, i.e., a character string that identifies the user to the server. The USER command must precede the PASS command.
PASS password
The PASS command to specify the password for the user whose name is specified by a prior USER command.
STAT
Information about server messages
RETR
Message number to be collected
DELE
Number of the message to be deleted
LIST [msg]
Number of the message to be displayed
NOOP
Lets keep the connection open in case of inactivity
TOP <messageID> <n>
Command that displays n lines of the message, whose number is given in the argument. In the case of a positive response from the server, it will send back the message headers, then a blank line and then the first n lines of the message.
UIDL [msg]
Request to the server to send a line containing information about the message possibly given in the argument. This line contains a character string called a unique identifier listing (list of unique identifiers) that uniquely identifies the message on the server, regardless of the session. The optional argument is a number related to an existing message on POP server, ie, a message that has not been erased.
QUIT
The QUIT command requests the POP3 server output. Leads to the elimination of all messages marked as deleted and sends the status of this action



Therefore, the POP3 protocol manages authentication using the user name and password. However, this is not safe, because passwords, like emails, circulating on the network as clear text (non-encrypted). In fact, according to RFC 1939, you can encrypt the password using an MD5 algorithm and benefit from secure authentication. However, because this command is optional, few servers deployed. In addition, the protocol POP3 inboxes blocks during access, which means that it is impossible for two users simultaneously access the same inbox.
In the same way that you can send an email using telnet, you can also access your incoming mail by using a simple telnet POP server port (110 by default):