SMTP means SIMPLE MAIL TRANSFER PROTOCOL. SMTP is a TCP protocol and it uses the port number 25 by default.SMTP is used to transfer the mails from one user to another user or multiple users.SMTP is a connection- oriented; text- based protocol, because a mail sender communicates with the mail receiver by issuing command strings and supplying necessary data over a reliable ordered data stream channel by using Transmission Control Protocol (TCP) connection. SMTP session consists of commands originated by SMTP client and corresponding responses for SMTP server so that session is opened and session parameters are changed.A session may have zero or more SMTP transactions.

Below we can see how to transfer mail by using SMTP:

Your ISP’S Server(Sender) Mail server(Receiver)

In this we have two servers .one is for sender another one is for receiver. SMTP takes the mail from the client and it sends to the sender server .The sender server checks whether the request is coming from port 25 or not.From the sender server it sends the mail to the receiver server. That is the work of the SMTP, then from the sender server POP3 and IMAP protocols takes place. Because these protocols are used to receive the mail.

SMTP transaction consists of a three command sequences.

They are
1. Mail
3. Data
Mail: This command is used to establish the return path or information about the sender; by using this we can send the bounce messages.
RCPT:This command, to establish a recipient of this message. This command can be issued multiple times, one for each recipient.
Data: This is the content of the message, as opposed to its envelope. It consists of a message header and a message body separated by an empty line.


For SMTP there are two test cases.

1. Banner grabbing
2. Open mail relay

First we check whether the host is up or not by using nmap scan.
Ex:nmap -sP

If the host is up then we have to scan for open ports.
Ex: nmap
If the port is open then we have to do the test cases.

1.Banner grabbing: It gives the version.
In this we are using ‘nc’ or ‘telnet’ .
Ex: nc port number

2.Open mail relay: It is an SMTP server configured in such a way that it allows anyone on the internet to send e-mail through it and originating from known users. This is used as a default configuration in many mail servers.

3.Clear text: Clear text means whatever we enter it will available to see, like mail ids and messages by using wire shark .When we send a mail to any one, just we have to run wire shark simultaneously,then we can see the data in clear text.